Sum of divisors X59222


Statement
 

pdf   zip

html

Write a funcion sum_divisors(n) that receives a natural number n>0 and returns the sum of all its divisors, except itself.

Sample session
>>> sum_divisors(1)
0
>>> sum_divisors(2)
1
>>> sum_divisors(6)
6
>>> sum_divisors(15)
9
>>> sum_divisors(24)
36
>>> sum_divisors(28)
28
>>> sum_divisors(47)
1
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python