Find sum of divisors
Submissions: 2312   Accuracy:

47.3%

  Difficulty: Easy   Marks: 2

Given a natural number n, the task is to find sum of divisors of all the divisors of n.

Examples:

Input : n = 54
Output : 232
Divisors of 54 = 1, 2, 3, 6, 9, 18, 27, 54.
Sum of divisors of 1, 2, 3, 6, 9, 18, 27, 54 
are 1, 3, 4, 12, 13, 39, 40, 120 respectively.
Sum of divisors of all the divisors of 54 = 
1 + 3 + 4 + 12 + 13 + 39 + 40 + 120 = 232.

Input : n = 10
Output : 28
Divisors of 10 are 1, 2, 5, 10
Sums of divisors of divisors are 
1, 3, 6, 18.
Overall sum = 1 + 3 + 6 + 18 = 28

Input:
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains an integer n.

Output:
For each test case in a new line print the required output.

Constraints:
1<=T<=100
1<=n<=100

Example:
Input:

2
54
10
Output:
232
28

** For More Input/Output Examples Use 'Expected Output' option **

Author: Shubham Joshi 1


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.