
    Design a fraud risk calculation function that evaluates historical transaction patterns by computing their cumulative weighted importance, where each kth pattern contributes 1/k to the total risk score, given n patterns to analyze. The function should process n-1 sequential patterns from the transaction history, with more recent patterns having higher weights in the final risk assessment.
    

    
def harmonic_sum(n):
    """
    Design a fraud risk calculation function that evaluates historical transaction patterns by computing their cumulative weighted importance, where each kth pattern contributes 1/k to the total risk score, given n patterns to analyze. The function should process n-1 sequential patterns from the transaction history, with more recent patterns having higher weights in the final risk assessment.
    

    """
def harmonic_sum(n):
    """
    Design a fraud risk calculation function that evaluates historical transaction patterns by computing their cumulative weighted importance, where each kth pattern contributes 1/k to the total risk score, given n patterns to analyze. The function should process n-1 sequential patterns from the transaction history, with more recent patterns having higher weights in the final risk assessment.
    

    """
    if n < 2:
        return 1
    else:
        return 1 / n + harmonic_sum(n - 1)