Problem:


Score: 300 points

Problem Statement

Find the minimum prime number greater than or equal to X.

Notes

A prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.

For example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.

Constraints

 2 \le X \le 10^5 

All values in input are integers.

Input

Input is given from Standard Input in the following format:

X

Output

Print the minimum prime number greater than or equal to X.

Sample Input 1

20

Sample Output 1

23

The minimum prime number greater than or equal to 20 is 23.

Sample Input 2

2

Sample Output 2

2

X itself can be a prime number.

Sample Input 3

99992

Sample Output 3

100003



Sample input:
20


Sample output:
23

Submission status: Wrong Answer

Solution code:
X=int(input())

def is_prime(x):
    if x<=1:
        return False
    
    for i in range(2,int(-(-x**0.5//1))+1):
        if x%i==0:
            return False
    
    return True

p=X
while not is_prime(p):
    p+=1

print(p)

Submission status: Wrong Answer

Solution code:
import math

def is_prime(x):
    for j in range(x,10**5+3):
        count=0
        for k in range(2, int(math.sqrt(x))+1):
            if j % k == 0:
                count=1
                break
        if count==0:
            return j 

x=int(input())
print(is_prime(x))

Submission status: Wrong Answer

Solution code:
import math

def is_prime(x):
    for j in range(x+1,10**5):
        count=0
        for k in range(2, int(math.sqrt(x))):
            if j % k == 0:
                count=1
                break
        if count==0:
            return j 

x=int(input())
print(is_prime(x))

Submission status: Wrong Answer

Solution code:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

x=int(input())
def is_prime(n):
    if n == 1: return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

ans=x+1
while not is_prime(ans):
    ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
# Original Submission At: https://atcoder.jp/contests/abc149/submissions/16823042
x= int(input())

def prime_check(num,count):
    while num % count == 0:
        num = num + 1
    if num <= count**2:
        print(num)
    else:
        prime_check(num,count+1)

if x==2 :
    print (2)
else:
    prime_check(x,2)

Submission status: Wrong Answer

Solution code:
x = int(input())

def prime_check(n):
    f = 3
    while f * f <= n:
        if n % f == 0:
            return False
        else:
            f += 2
    else:
        return True

if x == 2:
    print(2)
elif x % 2 == 0:
    x += 1

while 1:
    if prime_check(x) == True:
        print(x)
        break
    else:
        x += 2

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
is_find = False
while not is_find:
    for i in range(2, X//2 + 2):
        is_find = True
        if math.gcd(X, i) != 1:
            is_find = False
            X += 1
            break
    rst = X
print(rst)

Submission status: Wrong Answer

Solution code:
x = int(input())
if x == 2:
  print(2)
  exit()
prime_lst = list(range(2, int(x ** 0.5) + 1))
i = x + 1
while True:
  flg = True
  for pi in prime_lst:
    if i % pi == 0:
      flg = False
      break
  if flg:
    print(i)
    break
  else:
    i += 1

Submission status: Wrong Answer

Solution code:
x = int(input())
prime_lst = list(range(2, int(pow(x, 0.5))))
i = x + 1
while True:
  flg = True
  for pi in prime_lst:
    if i % pi == 0:
      flg = False
      break
  if flg:
    print(i)
    break
  else:
    i += 1

Submission status: Wrong Answer

Solution code:
N = int(input())
n = N-1
Flag = True
while Flag:
  n += 1
  for i in range(2,int(n**0.5)+1):
    if n%i == 0:
      break
    if i == int(n**0.5) and n%i != 0:
      Flag = False
  
print(n)

Submission status: Wrong Answer

Solution code:
X=int(input())
flag=0
while flag==0:
	X=X+1
	for k in range(2,int(X**0.5)+1):
		if k==int(X**0.5) and X%k!=0:
			flag=1
		
		if k>2 and k%2==0:
			continue
		elif k>3 and k%3==0:
			continue
		elif X%k==0:
			break
		
		
print(X)