A proper divisor of a positive integer n is any divisor of n except n itself. The aliquot sum is the sum of all proper divisors.
Given a positive integer n, return s, the sum of its proper divisors.
For example, the proper divisors of 12 are 1, 2, 3, 4, and 6, so the aliquot sum is 16.
Note: the aliquot sum of 1 is 0 (it has no proper divisors).
Examples:
n = 12 -> 16 (1 + 2 + 3 + 4 + 6)
n = 6 -> 6 (1 + 2 + 3, so 6 is a "perfect number")
n = 1 -> 0
n = 7 -> 1 (prime, only proper divisor is 1)
Solution Stats
Solution Comments
Show comments
Loading...
Problem Recent Solvers4
Suggested Problems
-
Sum of proper divisors (aliquot sum)
4 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!