Sum of Divisors
Return the sum of all positive divisors of n, including 1 and n.
Example 1
n 6
returns 12
1 + 2 + 3 + 6 = 12.
Example 2
n 7
returns 8
1 + 7 = 8.
Constraints
1 <= n <= 10**4
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Math problems
- Sum of MultiplesBeginner
- Type of TriangleBeginner
- Add Minutes to a ClockEasy
- Add StringsEasy
- Add Two Numbers in Base KEasy
- Angle Between Clock HandsEasy
- Area of Two RectanglesEasy
- Binary PalindromeEasy