There are N coins numbered from 1 to N, all turned tails. Multiple persons flip these coins. When the ith person enters, he flips all coins whose number is divisible by i. We have to determine the number of coins that will remain heads after N persons enter and perform fliping operation.
The first line contains T, the number of test cases. Then T lines follow.
Each line contains an integer, N, the number of coins.
Print the total number of coins that are on heads after performing N operations.
1 <= N <= 106
1 ) N=1 we flip coin 1 and after the first operation, 1st coin is heads.
2 ) N=2 we flip coins 1 and 2 after the first operation, but after the second operation, we again flip coin 2. So after the second operation, only coin 1 remains heads.
3 ) Similar explanation follows for N=3 .
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.