day1/exercise/aliquot.py
author Puneeth Chaganti <punchagan@fossee.in>
Tue, 12 Jan 2010 19:03:34 +0530
changeset 354 5dc6c3673f9d
parent 94 8c92864c184b
child 380 669b72283b55
permissions -rw-r--r--
Changes made during REC Chennai workshop.


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)