
N=3
Answer:- 1 ( 1 has 1 factor , 2 has 2 factors and 3 has 2 factors , so total 5 and 5 % 2 = 1).
The first line contains a single integer ‘T’ representing the number of test cases. Then each test case follows.
The first line of each test case contains an integer ‘N’.
For each test case, return the total number of factors of all the numbers from 1 to ‘N’ mod 2.
You are not required to print anything, it has already been taken care of. Just implement the function.
1 <= T <= 10^3
1 <= N <= 10^9
Time Limit: 1 sec
Find the factors of the numbers from 1 to N and sum them up and return the sum mod 2.
All numbers except perfect squares have an even number of factors. So we are only concerned with non-perfect squares. Find the number of perfect squares that lie between 1 to N. If the number of perfect squares is odd return 1 , else return 0.