day1/exercise/aliquot.py
author Santosh G. Vattam <vattam.santosh@gmail.com>
Mon, 22 Feb 2010 14:32:01 +0530
changeset 373 f04eca8b2f3d
parent 354 5dc6c3673f9d
child 380 669b72283b55
permissions -rw-r--r--
Commits from NIT DGP and IITK


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)