DIFFICULTY:
SIMPLE

PREREQUISITES:
Modulus Operator

Problem:

```
We are provided with a pattern of N numbers and have to find the output for each number of that sequence.
```

Quick Explanation:

```
If we look closely we can easily find that the output of each element of the sequence is the sum of divisors of that number excluding itself.
```

Explanation:

```
The output for each input number is the sum of its divisors exluding that number and it can be computed easily by checking for number i in range 1<=i<N.
Result can be computed in O(N) time.
Pseudo Code:
sum=0;
for i form 1 to N-1 :
if N%i==0 :
sum = sum+i;
end if
end for
return sum;
Time Complexity : O(T*N);
```

Editorialist's Solution:
Can be found here.

asked
**18 Mar '18, 18:53**

4★abhi55

42●6

accept rate:
5%