Learn
Exam

Calculate the Total Sum of Divisors

Difficulty
STARTER

Problem

Given a natural number number, write a function solution that returns the total sum of all divisors of each number from 1 to number.


Constraints

  • number is a natural number between 1 and 100 inclusive.

Test Case

Test Case Number number return
1 5 21
2 10 87
3 12 127

Explanation for Test Case 1

  • When number = 5, the divisors of each number from 1 to 5 are [1], [1, 2], [1, 3], [1, 2, 4], [1, 5]. The total sum is 21.

Explanation for Test Case 2

  • When number = 10, the total sum of divisors of each number from 1 to 10 is 87.

Explanation for Test Case 3

  • When number = 12, the total sum of divisors of each number from 1 to 12 is 127.