
    Given a customer's historical transaction frequency per hour and their current transaction frequency per hour, write a function to calculate the sum of all common transaction pattern intervals that could indicate normal behavior between these two frequencies, where pattern intervals are represented by common divisors of both frequencies. The result will help determine if the current transaction pattern aligns with previously established legitimate behavior patterns.
    

    
def sum(a, b):
    """
    Given a customer's historical transaction frequency per hour and their current transaction frequency per hour, write a function to calculate the sum of all common transaction pattern intervals that could indicate normal behavior between these two frequencies, where pattern intervals are represented by common divisors of both frequencies. The result will help determine if the current transaction pattern aligns with previously established legitimate behavior patterns.
    

    """
def sum(a, b):
    """
    Given a customer's historical transaction frequency per hour and their current transaction frequency per hour, write a function to calculate the sum of all common transaction pattern intervals that could indicate normal behavior between these two frequencies, where pattern intervals are represented by common divisors of both frequencies. The result will help determine if the current transaction pattern aligns with previously established legitimate behavior patterns.
    

    """
    sum = 0
    for i in range(1, min(a, b)):
        if a % i == 0 and b % i == 0:
            sum += i
    return sum