{"id":"ef8381ff-73ef-42c7-b87e-8413cbd8c7d9","name":"Sum Of Factors","description":"Given a number n, output the summation of all its proper Factors.\r\n\r\nNote: A proper Factor of a natural number is the divisor that is strictly less than the number.","inputFormat":"The first line contains integer t stating number of test cases. \r\nFor next t lines, each line contains an integer n.","outputFormat":"In each of t lines, print the summation of Factors of the Integer given.","constraints":"1<= t <= 10^5\r\n1<= n <= 10^5","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.ArrayList;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args) throws NumberFormatException, IOException {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\r\n }\r\n}\r\n"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"3\r\n2\r\n10\r\n20","sampleOutput":"1\r\n8\r\n22\r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"086949fa-3c5e-40c6-8a9c-f9be4b400318","name":"Number Theory For Experts","slug":"number-theory-for-experts","type":0},{"id":"b3bdd6a6-75eb-452b-bb32-135945f99b12","name":"Sum Of Factors","slug":"sum-of-factors","type":1}],"next":{"id":"11157595-ef8a-4538-aecc-f56d867ec34e","name":"Chinese Remainder Theorem","type":1,"slug":"chinese-remainder-theorem"},"prev":{"id":"d8bd2d16-c0f4-4976-a080-a1eea0465200","name":"Relatively Prime Pairs","type":1,"slug":"relatively-prime-pairs"}}}

Sum Of Factors

Given a number n, output the summation of all its proper Factors. Note: A proper Factor of a natural number is the divisor that is strictly less than the number.

{"id":"ef8381ff-73ef-42c7-b87e-8413cbd8c7d9","name":"Sum Of Factors","description":"Given a number n, output the summation of all its proper Factors.\r\n\r\nNote: A proper Factor of a natural number is the divisor that is strictly less than the number.","inputFormat":"The first line contains integer t stating number of test cases. \r\nFor next t lines, each line contains an integer n.","outputFormat":"In each of t lines, print the summation of Factors of the Integer given.","constraints":"1<= t <= 10^5\r\n1<= n <= 10^5","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.ArrayList;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args) throws NumberFormatException, IOException {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\r\n }\r\n}\r\n"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"3\r\n2\r\n10\r\n20","sampleOutput":"1\r\n8\r\n22\r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"086949fa-3c5e-40c6-8a9c-f9be4b400318","name":"Number Theory For Experts","slug":"number-theory-for-experts","type":0},{"id":"b3bdd6a6-75eb-452b-bb32-135945f99b12","name":"Sum Of Factors","slug":"sum-of-factors","type":1}],"next":{"id":"11157595-ef8a-4538-aecc-f56d867ec34e","name":"Chinese Remainder Theorem","type":1,"slug":"chinese-remainder-theorem"},"prev":{"id":"d8bd2d16-c0f4-4976-a080-a1eea0465200","name":"Relatively Prime Pairs","type":1,"slug":"relatively-prime-pairs"}}}
plane

Editor


Loading...

Sum Of Factors

medium

Given a number n, output the summation of all its proper Factors. Note: A proper Factor of a natural number is the divisor that is strictly less than the number.

Constraints

1<= t <= 10^5 1<= n <= 10^5

Format

Input

The first line contains integer t stating number of test cases. For next t lines, each line contains an integer n.

Output

In each of t lines, print the summation of Factors of the Integer given.

Example

Sample Input

3 2 10 20

Sample Output

1 8 22

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode