# Computes n factorial recursively def factorial(n): if n == 0: return 1 return n * factorial(n - 1) # Computes the sum of a list of numbers def sum_list(l): if len(l) == 0: return 0 return l[0] + sum_list(l[1:]) # Computes the greatest common denominator of m and n # Uses euclid's algorithm def gcd(m, n): if n == 0: return m return gcd(n, m % n)