Given a number N, you have to find nearest prime number. If there are more then one, print the smaller one.
First line of input contains T denoting number of test cases. Only line of each test case contains one integers N, as described above.
For each test case output a single line containing one integer, the answer to the above problem.
1<= T <= 100000
2<= N <= 106
Test case 1- for 6, both 5 and 7 are at same distance, but we need to print the smaller one, so output is 5
Test case 2-for 14, nearest prime number is 13
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.