Given a number N, calculate the prime numbers upto N using Sieve of Eratosthenes.
The first line of the input contains T denoting the number of testcases. T testcases follow. Each testcase contains one line of input containing N.
For all testcases, in a new line, print all the prime numbers upto or equal to N.
1 <= T<= 100
1 <= N <= 104
2 3 5 7
2 3 5 7 11 13 17 19 23 29 31
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.