DIVSUM - Divisor Summation


Given a natural number n (1 <= n <= 500000), please output the summation of all its proper divisors.

Definition: A proper divisor of a natural number is the divisor that is strictly less than the number.

e.g. number 20 has 5 proper divisors: 1, 2, 4, 5, 10, and the divisor summation is: 1 + 2 + 4 + 5 + 10 = 22.

Input

An integer stating the number of test cases (equal to about 200000), and that many lines follow, each containing one integer between 1 and 500000 inclusive.

Output

One integer each line: the divisor summation of the integer given respectively.

Example

Sample Input:
3
2
10
20

Sample Output:
1
8
22

Warning: large Input/Output data, be careful with certain languages


hide comments
kikuri: 2016-10-20 06:39:54

i'm getting TLE why?? :(

radiance_1995: 2016-10-19 00:34:34

i am getting an internal error , any help ? and my internet connection is not bad

johnfeitosa: 2016-10-16 17:01:52

hey some one is trying now? i am having troubles with execution time ...

Dimas Hirda Pratama: 2016-09-30 12:40:10

TLE :(

ajay: 2016-09-24 17:11:03

what is the basic idea to attempt to this problem

reconnect: 2016-09-14 17:24:39

why am I getting WA although the code gives the right output on my machine? Please anybody help. I'm stuck.

Gaurav: 2016-09-14 15:33:33

Any idea what's wrong with solution # 17711087. I am gettign WA. It's in golang

Missed out case where num=1.

Last edit: 2016-09-14 15:36:31
sahild95: 2016-08-13 08:51:31

I don't know why I'm getting WA when I believe my logic is correct and sample cases are also getting passed. Please see my solution at: <snip>

Last edit: 2023-05-09 11:42:07
saini428: 2016-06-19 05:45:07

don't think to much.....simple

vignesh97: 2016-06-17 19:52:14

easy problem, AC in first go...


Added by:Neal Zane
Date:2004-06-10
Time limit:3s
Source limit:5000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Neal Zane