All Tracks Math Number Theory Basic Number Theory-2 Problem

Nearest Prime
Tag(s):

Easy

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
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

Codeclub jusl

Challenge Name

ALGOMANIAC PRELIMS

OTHER PROBLEMS OF THIS CHALLENGE
Уведомления
View All Notifications

?