Next Prime (Hard)

View as PDF

Submit solution


Points:15
Time limit:2.0s
Memory limit:64M

Problem type

Allowed languages
Ada, Assembly, Awk, Brain****, C, C++, COBOL, CommonLisp, Dart, Erlang, Forth, Fortran, Intercal, Octave, Pascal, Prolog, R, Racket, Rust, Scheme, Sed, TCL, Text, Turing, VB

Brute Force Practice 3 — Hard Version

You love prime numbers. You own a number, but you suspect it might not be prime. You want a prime number, but it must be at least as large as the number you currently own. Find the smallest number that satisfies those conditions.

Input

The first line will have the integer N (1 \le N \le 10^{18})

Output

Print the number you want.

Sample Input

4

Sample Output

5

Comments


  • 1
    println_hi_
     commented on Oct. 15, 2016, 1:44 p.m.
    Python disabled?

    What is submitting code in python not allowed for this problem?


  • 0
    parkjs814
     commented on Sept. 18, 2016, 2:08 a.m.
    aa

    x^2


  • 1
    FatalEagle
     commented on March 23, 2015, 8:10 p.m.
    No partial output

    Partial output is disabled for this problem.