#K68247. Smallest Prime Greater Than or Equal to N
Smallest Prime Greater Than or Equal to N
Smallest Prime Greater Than or Equal to N
Given an integer \(N\), find the smallest prime number \(p\) such that \(p \ge N\). A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. For example, when \(N=10\), the answer is \(11\) because \(11\) is prime and is the smallest prime not less than \(10\).
Your program should read input from stdin
and write the result to stdout
.
inputFormat
The input consists of a single integer \(N\) (\(0 \le N \le 10^6\)) provided in one line from stdin
.
outputFormat
Output a single integer, which is the smallest prime number greater than or equal to \(N\), to stdout
.
10
11