We are provided with a pattern of N numbers and have to find the output for each number of that sequence.
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.
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);
Can be found here.