We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

- All Contests
- ProjectEuler+
- Project Euler #21: Amicable numbers

# Project Euler #21: Amicable numbers

# Project Euler #21: Amicable numbers

_{This problem is a programming version of Problem 21 from projecteuler.net}

Let be defined as the sum of proper divisors of (numbers less than which divide evenly into ).

If and , where , then and are an amicable pair and each of and are called amicable numbers.

For example, the proper divisors of are therefore . The proper divisors of are so .

Evaluate the sum of all the amicable numbers under .

**Input Format**

The first line contains an integer , i.e., number of test cases.

Next lines will contain an integer .

**Constraints**

**Output Format**

Print the values corresponding to each test case.

**Sample Input**

```
1
300
```

**Sample Output**

```
504
```

**Explanation**

Under we only have and , sum is