Compute the sum of all positive divisors of n, including 1 and n itself.
One line: a positive integer n.
One line: the sum of all divisors of n.
Example 1
Input
6
Expected
12
Explanation
Divisors of 6 are 1,2,3,6 which sum to 12.
Example 2
Input
7
Expected
8
Explanation
7 is prime; its divisors 1 and 7 sum to 8.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →