Minimum sum of factors
Submissions: 1395   Accuracy:

12.44%

  Difficulty: Basic   Marks: 1

Given a number, find minimum sum of its factors.

Input:
First line consists of T, test cases. Only line of every test case consists of an integer N

Output:
Single line output, print the Sum of factors.

Constraints:
1<=T<=100000
1<=N<=100000

Example:
Input:

2
11
12
Output:
12
7

Explanation:
Following are different ways to factorize 12 and sum of factors in different ways.
12 = 12 * 1 = 12 + 1 = 13
12 = 2 * 6 = 2 + 6 = 8
12 = 3 * 4 = 3 + 4 = 7
12 = 2 * 2 * 3 = 2 + 2 + 3 = 7
Therefore minimum sum is 7

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

Contributor: Saksham Raj Seth
Author: saksham seth


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.