summaryrefslogtreecommitdiff
path: root/day1/exercise/aliquot.py
blob: 25518f0e99be30410617c71fe32d3094cba44a35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14

def aliquot(n):
    sum = 1
    i = 2

    while i * i < n: 
        if n % i == 0:
            sum += i + (n / i)
        i += 1
    if n % i == 0: sum += i
    return sum

n = int(raw_input('Enter a number? '))
print aliquot(n)