## 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
 visvats_141095: 2016-06-05 19:08:56 AC in first go! :D azam_9: 2016-06-03 08:59:07 modified sieve also works.. katyalch: 2016-05-16 05:48:30 uh oh tle manav_itmu: 2016-05-15 21:32:31 tle. any help ? shubhanshu001: 2016-05-15 15:35:05 AC in first go!!..:) mohitgupta07: 2016-05-08 21:12:56 yeah...simple maths..:) :) feeling gud after doing it wid just 1 try(actually got 1 wa coz of that n=1 )..yeah :D shanti_chai: 2016-04-24 15:43:14 @hrithik,vijay... calculate divisors up to sqrt(n) . For better runtime you can use modified sieve hrithik_sethia: 2016-04-19 19:59:31 getting tle please how do we do this?? vijayreddie: 2016-03-24 06:12:37 time limit exceeded how to pranjalikumar9: 2016-02-14 18:27:14 Just need to know that divisors exist in pairs. If i divides n then n/i also divides n. And smaller of the 2 divisors lies below sqrt(n)

 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