All Tracks Math Number Theory Basic Number Theory-2 Problem

Nearest Prime
/
No tags
Problem
Editorial
Analytics

Joy is a hacker at hackerclub and he got a new problem on prime numbers.The problem states that given an integer N find the nearest prime number to N.If multiple answer is possible then output the smallest one of them.There are T number of test cases.
1<=N<10^6
1<=T<=2*10^6
INPUT:First line of input contains an Integer T denoting the number of test cases.
Next each of the T lines contain one integer N.
OUTPUT:output the nearest prime number possible to N in a new line

SAMPLE INPUT
3
51
12
65
SAMPLE OUTPUT
53
11
67
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

This Problem was Asked in

Initializing Code Editor...
Notifications
View All Notifications

?