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

Solution (Python):
def prime(n):
    is_prime=[True]*(n+1)
    is_prime[0],is_prime[1]=False,False
    for i in range(2,int(n**0.5)+1):
        if not is_prime[i]:continue
        for j in range(i*2,n+1,i):
            is_prime[j]=False
    return [i for i in range(n+1) if is_prime[i]]


n=int(input())
prime=prime(10**6)
for i in prime:
    if i>=n:print(i);exit()

Solution (Python):




def II(): return int(input())


















def is_prime(n):
    for i in range(2, int(pow(n, 0.5))+1):
        if n % i == 0:
            return False

    return True


def solve():
    X = II()

    while 1:
        if is_prime(X):
            print(X)
            return

        X += 1



if __name__ == '__main__':
    solve()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2, sqrt
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush

def is_prime(n):
    for i in range(2, int(sqrt(n))+1):
        if n % i == 0:
            return False

    return True


def solve():
    X = II()

    while 1:
        if is_prime(X):
            print(X)
            return

        X += 1



if __name__ == '__main__':
    solve()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush

def is_prime(n):
    for i in range(2, int(pow(n, 0.5))+1):
        if n % i == 0:
            return False

    return True


def solve():
    X = II()

    while 1:
        if is_prime(X):
            print(X)
            return

        X += 1



if __name__ == '__main__':
    solve()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush


def solve():
    X = II()

    while 1:
        for i in range(2, int(pow(X, 0.5))+1):
            if X % i == 0:
                break
        else:
            print(X)
            return

        X += 1



if __name__ == '__main__':
    solve()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush


def solve():
    X = II()

    while 1:
        for i in range(2, X):
            if X % i == 0:
                break
        else:
            print(X)
            return

        X += 1



if __name__ == '__main__':
    solve()

Solution (Python):
X = int(input())

if X == 2:
    print(2)
    quit()

if X % 2 == 0:
    f = X+1
else:
    f = X


while True:
    flag = True
    for i in range(2, int(f**0.5)+1):
        
        if f % i == 0:
            ｆ += 2
            flag = False
            break
    if flag:
        print(f)
        break

Solution (Python):
x = int(input())

for i in range(x, 10**5 + 4):
    flag = True
    for j in range(2, i):
        if (i % j == 0):
            flag = False
            continue
    if flag:
        print(i)
        break
    else:
        continue

Solution (Python):
x = int(input())

while True:
    for i in range(2, x):
        if x % i == 0:
            break
    else:
        print(x)
        break
    x += 1

Solution (Python):






X = int(input())





ans = X
while True:
    flg = False
    for i in range(2,ans+1):
        if i < ans:
            if ans%i == 0:
                ans += 1
                break
        else:
            flg = True
    if flg:
        break
print(ans)

Solution (Python):


def SieveOfEratosthenes(n):
    prime_list = [True] * (n+1)
    p = 2
    while (p ** 2 <= n):
        if prime_list[p]:
            for i in range(p ** 2, n+1, p):
                prime_list[i] = False
        p += 1
    return prime_list

def main():
    X = int(input())
    N = 10 ** 6 + 500
    prime_idx = SieveOfEratosthenes(N)
    primes = [val for val, idx in zip(range(N+1), prime_idx) if idx]
    ans = [x for x in primes if x >= X]
    print(ans[0])

if __name__ == '__main__':
    main()

Solution (Python):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline



def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    x = gete(int)
    MAX_I = 100005
    p = [True] * MAX_I
    p[0], p[1] = False, False

    for i in range(2, MAX_I):
        if p[i]:
            for j in range(2 * i, MAX_I, i):
                p[j] = False

    for i in range(x, MAX_I):
        if p[i]:
            print(i)
            break


if __name__ == "__main__":
    main()

Solution (Python):
import bisect
x = int(input())
def primes(max_number):
    pr = list(range(3, max_number+1, 2))
    lpr = len(pr)
    for i,n in enumerate(pr):
        if n:
            if n*n > max_number:
                break
            for j in range(i+n, lpr, n):
                pr[j] = 0
    yield 2
    yield from[i for i in pr if i]

a = list(primes(101000))
bi = bisect.bisect(a, x)
if a[bi-1] == x:
    print(x)
else:
    print(a[bi])

Solution (Python):

import math

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
x = int(input())
for i in range(x, 1000000):
    if is_prime(i) == True:
        break
print(i)

Solution (Python):
def f(n):
    if n==2:return 2
    for i in range(2,[n, 5][n>5]):
        if i**n%n != i:
            return f(n+1)
    return n
print(f(int(input())))

Solution (Python):
x=int(input())
while True:
  for j in range(2,x):
    if x%j==0:
      x+=1
      break
  else:
    print(x)
    break

Solution (Python):
X = int(input())
if X == 2:
  y = 2
elif X%2 ==0:
  y = X+1
else:
  y = X
Flag = True
while Flag == True:
  a = int(y**(1/2))
  t = 0
  for i in range(2,a):
    if y % i == 0:
      t = 1
  if t == 0:
    Flag = False
  y += 1
print(y-1)

Solution (Python):

import sys
import math


def solve(X: int):
    for x in range(X, 200003):
        if is_prime(x):
            print(x)
            break
    return


def is_prime(n: int):
    if n == 2:
        return True
    if n % 2 == 0:
        return False

    for p in range(3, math.floor(math.sqrt(n) + 1), 2):
        if n % p == 0:
            return False
    return True



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    X = int(next(tokens))  
    solve(X)


if __name__ == "__main__":
    main()

Solution (Python):
X=int(input())
while True:
    for i in range(2,X-1):
        if X%i==0:
            X+=1
            break
    else:
        print(X)
        exit()

Solution (Python):
N = int(input())

for i in range(N,10**10):
    f = 0
    for j in range(2,i-1):
        
        if i % j == 0:
            f += 1
            break
    if f == 0:
        print(i)
        exit()

Solution (Python):
import math


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


def main():
    x = int(input())

    while True:
        if is_prime(x):
            ans = x
            break
        x += 1

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
def checkPrime(n):
    if n%2 == 0:
        return False
    for i in range(1, int(n**(1/2))//2+1):
        if n%(i*2+1) == 0:
            return False
    return True

X = int(input())
if X == 2:
    print(2)
    sys.exit()
if X%2 == 0:
    X += 1
while not checkPrime(X):
    X += 2
print(X)

Solution (Python):
def is_prime(p):
  if p>1:
    for i in range(2,p):
      if p%i==0:return True
  return False

X=int(input())
p=X
while is_prime(p) != False:p+=1
print(p)

Solution (Python):
x = int(input())

while True:
  ok = True
  i = 2
  while i * i <= x:
    if x % i == 0:
      ok = False
      break
    i += 1
  if ok:
    print(x)
    break
  x += 1

Solution (Python):
import math
x = int(input())
while True:
    for i in range(2, int(math.sqrt(x)) + 1):
        if x % i == 0:
            x += 1
            break
    else:
        print(x)
        break

Solution (Python):
from math import sqrt


def isPrime(n):
    if n > 2 and n % 2 == 0: return False
    i = 3
    while i <= sqrt(n):
        if n % i == 0:
            return False
        i += 2
    return n > 1


n = int(input())
while not isPrime(n):
    n += 1
print(n)

Solution (Python):
X=int(input())

import math
def prime_num(k):
    for divisor in range(2, math.floor(math.sqrt(k))+1):
            if k % divisor == 0:
                return False
    else:
        return True
      
for i in range(X,100010):
    if prime_num(i)==True:
        print(i)
        break

Solution (Python):
x = int(input())

flag = False
next = False
while not flag:
    for i in range(2, x, 1):
        if x%i == 0:
            next = True
            break
    if next:
        x += 1
        next = False
        continue
    else:
        print(x)
        exit()

Solution (Python):
x = int(input())

ans = 0

for i in range(x, 100004):
    tmpf = 1
    for j in range(2, int(i**0.5)):
        if i % j == 0:
            tmpf = 0
            break
    if tmpf == 1:
        ans = i
        break
    
print(ans)

Solution (Python):
x = int(input())
f = 0
while True:
    for i in range(x-1,0,-1):
        if i==1:
            f=1
            print(x)
            break
        if x%i==0:
            break
        
    if f==1:
        break
    x+=1

Solution (Python):
import math
x = int(input())
a = int(x/2) + 1
while 1:
  for i in range(2,a):
    if not x % i:
      x += 1
      break
  else:
    ans = x
    break

print(ans)

Solution (Python):
import math
x = int(input())
a = int(x/2) + 1
while 1:
  for i in range(2,a):
    if not x % i:
      x += 1
      break
  else:
    ans = x
    break

print(ans)

Solution (Python):

x = int(input())

if x <= 2 :
  print(x)
  exit()

if x % 2 ==0:
  x += 1
comp = True
while comp :
  comp = False
  for i in range(2,x):
    if x % i == 0:
      comp = True
      break

  if comp :
    x += 2

print(x)

Solution (Python):
NumPri = int(input())
Triger = 0
while True:
  for i in range(2,NumPri):
    if NumPri%i == 0:
      NumPri += 1
      Triger += 1
      break
  if Triger == 1:
    Triger = 0
    continue
  print(NumPri)
  break

Solution (Python):

import sys


def solve(X: int):
    primes = get_prime_numbers_array(2 * (10**5))
    for i, v in enumerate(primes):
        if v and i >= X:
            print(i)
            return
    return


def get_prime_numbers_array(n: int):
    """エラトステネスのふるいを用いてnまでの素数判定を行うための配列を返す"""
    N = n + 1
    is_prime = [1] * N
    is_prime[0] = is_prime[1] = 0
    for i in range(2, N):
        if not is_prime[i]:
            continue
        for j in range(i * 2, N, i):
            is_prime[j] = 0
    return is_prime



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  
    solve(X)

if __name__ == '__main__':
    main()

Solution (Python):
X = int(input())

while True:
    for i in range(2, int(X**0.5)+1):
        if X % i ==0:
            X += 1
            break
    else:
        print(X)
        break

Solution (Python):
x = int(input())

while True:
    flag = True
    for i in range(2,x):
        if x%i==0:
            flag = False
    if flag:
        print(x);exit()
    else:
        x+=1

Solution (Python):
x = int(input())
while any(x % i == 0 for i in range(2,x)):
    x += 1
print(x)

Solution (Python):
import math
X = int(input())

def isprime(n):
    for i in range(2,math.ceil(math.sqrt(n))):
        if n%i == 0:
            return False
    return True

while True:
    if isprime(X):
        break
    X += 1

print(X)

Solution (Python):
x=int(input())

while True:
  i=2
  ok=True
  while i*i<=x:
    if x % i == 0:
      ok=False
      break
    i+=1
  if ok:
    print(x)
    break
  x+=1

Solution (Python):
import math
x = int(input())
while True:
    key = 1
    for k in range(2, int(math.sqrt(x))+1):
        if x % k == 0:
            key = 0
    if key == 1:
        print(x)
        exit()
    else:
        x += 1

Solution (Python):
X = int(input())
num = X

def isPrime(num):
	if num == 1 or num == 2:
		return True
	for i in range(2,num):
		if num % i == 0:
			return False
	return True


while True:
	if isPrime(num):
		print(num)
		break
	num += 1

Solution (Python):


x = int(input())
result = True
hantei = False
sum = 0


while hantei == False:
    hantei = True

    for i in range(2,x):
        
        if x % i == 0:
            hantei = False
            break

    
    


    x += 1

print(x-1)

Solution (Python):
import math


def li():
    return list(map(int, input().split()))


def mi():
    return map(int, input().split())


def ii():
    return int(input())


def is_prime(n):
    for i in range(2, int(math.sqrt(n))):
        if n % i == 0:
            return False
    return True


def next_prime(n):
    i = n
    while True:
        if is_prime(i):
            return i
        i += 1


X = ii()

print(next_prime(X))

Solution (Python):
import math

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

Solution (Python):
X = int(input())

def check(num):
    max_div = int(num**0.5)
    for div in range(2, max_div+1):
        if num % div == 0:
            return False
    else:
        return True

num = X
while True:
    if check(num):
        print(num)
        break
    
    num += 1

Solution (Python):

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


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


def main():
    X = int(readline())
    while not is_prime(X):
        X += 1
    print(X)


if __name__ == '__main__':
    main()

Solution (Python):
x = int(input())

import math



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

while(1):
    if(is_prime(x)):
        print(x)
        break
    x += 1

Solution (Python):
import math

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

x = int(input())
while True:
    if is_prime(x):
        print(x)
        break
    else:
        x += 1

Solution (Python):
def is_prime(a):
    for i in range(2, int(a**0.5)+1):
        if a%i == 0:
            return False
    return True

X = int(input())

for i in range(X, 100004):
    if is_prime(i):
        print(i)
        break

Solution (Python):
def is_prime(a):
    if a == 2:
        return True
    for i in range(2, int(a**0.5)+2):
        if a%i == 0:
            return False
    return True

X = int(input())

for i in range(X, 100004):
    if is_prime(i):
        print(i)
        break

Solution (Python):
x = int(input())
ans = 0
for i in range(x,2*x):
    s = 0
    for j in range(2,int(pow(i,0.5))+1):
        if i%j == 0:
            s = 1
            break
    if s == 0:
        break
print(i)

Solution (Python):
x = int(input())
ans = 0
if x <= 3:
    i = x
else:
    for i in range(x,2*x):
        s = 0
        for j in range(2,int(pow(i,0.5))+1):
            if i%j == 0:
                s = 1
                break
        if s == 0:
            break
print(i)

Solution (Python):
import math

def isPrime(num):
    if num < 2:
        return False
    elif num == 2:
        return True
    elif num % 2 == 0:
        return False

    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False
    
    return True


def find_min_prime(num):
    if num == 2:
        return 2
    if num % 2 == 0:
        num +=1

    while True:
        if isPrime(num):
            break
        num += 2
        
    return num


X = int(input())
print(find_min_prime(X))

Solution (Python):
def countyakusu(n):
	yakusuu=[]
	for i in range(1,int(n**0.5)+1): 
		if n%i==0:
			yakusuu.append(i)
			if i!=n//i:
				yakusuu.append(n//i)
	return yakusuu
x = int(input())
for i in range(x,10**6):
	cnt = countyakusu(i)
	if len(cnt) == 2:
		print(i)
		break

Solution (Python):
def isPrime(x):
  for i in range(2,int(x**0.5)+1):
    if x%i==0:
      return False
  return True

n = int(input())

for i in range(n,10**6):
  if isPrime(i):
    print(i)
    break

Solution (Python):
m=int(input())

for j in range(m,1000000):
    
    pf={}
    for i in range(2,int(j**0.5)+1):
        while j%i==0:
            pf[i]=pf.get(i,0)+1
            j//=i
    if j>1:pf[j]=1
    
    if sum(pf.values())==1:
        print(j)
        exit()

Solution (Python):
primes = set([2])
X = int(input())
if X == 2:
    print(2)
else:
    for i in range(3, int(X ** .5) + 1, 2):
        for p in primes:
            if i % p == 0:
                break
        else:
            primes.add(i)
    
    x = X
    if x % 2 == 0:
        x += 1
    found = False
    while not found:
        for p in primes:
            if x % p == 0:
                break
        else:
            print(x)
            found = True
        x += 2

Solution (Python):
X=int(input())
a=True
b=True
ans=0

while a==True:
    for i in range(X-1):
        if X==i+2:
            a=False
            ans=X
        if X%(i+2)==0 and X!=i+2:
            break
    X+=1

print(ans)

Solution (Python):
X = int(input())
i =0
while i <= X:
    for i in range(2,X+1):
        mod = X%i
        if mod ==0 : 
            if i == X:
                print(X)
                break
            elif i < X:
                X = X+1
    i = i+1

Solution (Python):
serach_number = int(input())

def search_prime_number(target):
 
    for i in range(2,serach_number-1 ):
        if target % i == 0:
            return False
    return True

while True:
  if search_prime_number(serach_number):
    print(serach_number)
    break
  serach_number+=1

Solution (Python):
import math
serach_number = int(input())

def search_prime_number(target):
    square  = int(math.sqrt(target))
 
    for i in range(2,square ):
        if target % i == 0:
            return False
    return True

while True:
  if search_prime_number(serach_number):
    print(serach_number)
    break
  serach_number+=1

Solution (Python):
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

def main():
    x = int(input())
    for i in range(x, 10**10+1):
        if is_prime(i):
            print(i)
            return
        

if __name__ == '__main__':
    main()

Solution (Python):
import math

def prime(n):
    prime=True
    s=int(math.sqrt(n))
    for i in range(2,s+1):
        if n%i==0:
            prime=False
            break
    
    return prime

def main():
    
    ans=0
    X=int(input())
    for j in range(X):
        if prime(X+j):
            ans=X+j
            break
    print(ans)
    
if __name__=="__main__":
    main()

Solution (Python):
import math

def is_prime(n):
	if n == 2:
		return True
	z = math.floor(n**0.5)
	for i in range(2, z + 1):
		if n % i == 0:
			return False
	return True

x = int(input())
while not is_prime(x):
	x += 1
print(x)

Solution (Python):
def prime(num):
  for p in range(2, num):
    if num % p == 0:
      return False
    else:
      continue
    return True


X = int(input())
i = 0
while prime(X+i) == False:
  i+=1
print(X+i)

Solution (Python):
n=int(input())
 
def is_prime(n):
    if n < 2:
      return False
    else:
      for i in range(2, n):
        if i * i > n:
            break
        elif n % i == 0:
            return False
    return True

for i in range(n,n+400):
  if is_prime(i):
    print(i)
    break

Solution (Python):
import math
serach_number = int(input())

def trial_division(target):
    dest = int(math.sqrt(target))
 
    for i in range(2,dest):
        if target % i == 0:
            return False
    return True

while True:
  if trial_division(serach_number):
    print(serach_number)
    break
  serach_number+=1

Solution (Python):
x = int(input())
i = 2
while True:
    while i * i <= x:
        if x % i == 0:
            break
        i += 1
    else:
        print(x)
        exit()
    i = 2
    x += 1

Solution (Python):
n=int(input())
f=0
while 1:
    for i in range(2,n//2+1):
        if n%i==0:
            break
        elif i==n//2:
            f=1
            break
    if n==2:
        print(2)
        break
    if f==1:
        print(n)
        break
    n+=1

Solution (Python):
x = int(input())


def is_prime(n, i=2):
    if (n % i == 0):
        return False
    elif (i * i > n):
        return True

    return is_prime(n, i + 1)


if x > 3:
    while(is_prime(x) == False):
        x += 1

print(x)

Solution (Python):
x = int(input())


def is_prime(n, i=2):
    
    
    
    if (n % i == 0):
        return False
    elif (i * i > n):
        return True

    return is_prime(n, i + 1)

if x > 3:
    while(is_prime(x) == False):
        x += 1

print(x)

Solution (Python):
x = int(input())


def is_prime(n, i=2):
    if (n == 2):
        return True
    elif (n % i == 0):
        return False
    elif (i * i > n):
        return True

    return is_prime(n, i + 1)


while(is_prime(x) == False):
    x += 1

print(x)

Solution (Python):
x = int(input())


def prime(n):
    flag = ''
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            break
    else:
        flag = 'prime_number'

    return(flag)


while(prime(x) != 'prime_number'):
    x += 1

print(x)

Solution (Python):
x = int(input())


def prime(n):
    flag = ''
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            break
    else:
        flag = 'prime_number'

    return(flag)


if x == 2:
    print(2)
else:
    i = x + int(x % 2 == 0)

    while(prime(i) != 'prime_number'):
        i += 1

    print(i)

Solution (Python):
x = int(input())


def prime(n):
    flag = ''
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            break
    else:
        flag = 'prime_number'

    return(flag)


if x == 2:
    print(2)
else:
    i = x + int(x % 2 == 0)

    while(True):
        if prime(i) == 'prime_number':
            break

        i += 1

    print(i)

Solution (Python):
def is_prime(n):
    if n==1:
        return False
    for i in range(2, int(n**.5)+1):
        if n%i==0:
            return False
    return True

x = int(input())
if x!=2 and x%2==0:
    x+=1
for i in range(x, 10**6, 2):
    if is_prime(i):
        print(i)
        break

Solution (Python):
def is_prime(n):
    if n==1:
        return False
    for i in range(2, int(n**.5)+1):
        if n%i==0:
            return False
    return True

x = int(input())
for i in range(x, 10**6):
    if is_prime(i):
        print(i)
        break

Solution (Python):
n=int(input())
while True:
  for i in range(2,n):
    if n%i==0:
      break
  else:
    print(n)
    break
  n+=1

Solution (Python):
x = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if x == 1:
    print(2)
    exit()
i = 0
while True:
    a = prime_factorize(x + i)
    if len(a) == 1:
        print(x + i)
        exit()
    i += 1

Solution (Python):
x = int(input())
for i in range(x,x+100):
    for j in range(2,i//2):
        if i%j==0:
            break
    else:
        print(i)
        break

Solution (Python):
x = int(input())
flag = 0
flag2 = 0
div = 2
roop = 0
ans = []
while flag2 == False:
    if x == 2 or x == 3:
        ans = x
        break
    while flag == False:
        roop += 1
        if x%div == 0:
            break
        elif x%div != 0:
            if div%2 == 0:
                div += 1
            elif div <= x*0.5:
                div +=2
            else:
                ans = x
                break
    if x%2 == 0:
        x += 1
    else:
        x += 2
    div = 2
    if ans != []:
        flag2 = 1

print(ans)

Solution (Python):
import math
x = int(input())

def isPrime(n):
    check = 1
    nsq = int(math.sqrt(n))
    for i in range(2,nsq+1):
        if n % i != 0:
            check += 1
        else:
            pass
            
    if check == nsq:
        return True
    else:
        False

for i in range(x):
    if isPrime(x+i):
        print(x+i)
        break
    else:
        pass

Solution (Python):
import sys
x=int(input())
if x==2:
    print(2)
    sys.exit()
while True:
    flag=-1
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            flag=1
    if flag==-1:
        print(x)
        sys.exit()
    x+=1

Solution (Python):
from sys import stdin
import math

def is_prime(num):
  if num % 2 == 0 and num != 2:
    return False
  else:
    for i in range(2, math.floor(math.sqrt(num))+1):
      if num % i == 0:
        return False
  return True

x = int(stdin.readline().strip())
while(True):
  if is_prime(x):
    break
  x += 1
  
print(x)

Solution (Python):
import math


def is_prme_number(num):
    if num == 1:
        return False

    for i in range(2, int(math.sqrt(num)) + 1):
        if num % i == 0:
            return False

    return True


def main():
    x = int(input())
    while True:
        if is_prme_number(x):
            break
        x += 1
    print(x)


if __name__ == '__main__':
    main()

Solution (Python):
x = int(input())
if x == 2:
    print(2)
    exit()
elif x%2 == 0:
    x += 1
 
def get_prime(n):
    p = [2]
    for i in range(3, n, 2):
        if all(i%j!=0 for j in p):
            p.append(i)
    return p
 
p = get_prime(x)
 
while True:
    for prime in p:
        if x%prime == 0:
            break
    else:
        print(x)
        break
    x += 2

Solution (Python):
x = int(input())

def get_prime(n):
    p = [2]
    for i in range(3, n, 2):
        if all(i%j!=0 for j in p):
            p.append(i)
    return p

p = get_prime(x)

if x == 2:
    print(2)
else:
    if x%2 == 0:
        x += 1
    while True:
        for prime in p:
            if x%prime == 0:
                break
        else:
            print(x)
            break
        x += 2

Solution (Python):
import math

X=int(input())


  
while True:
  dest=int(math.sqrt(X))
  for i in range(2,dest+2):
    if X%i==0 and X!=i:
      break
  else:
    print(X)
    exit()
  
  X+=1

Solution (Python):

import math















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


def main():

    X = int(input())

    while True:
        if is_prime(X):
            print(X)
            exit()
        else:
            X += 1


if __name__ == '__main__':
    main()

Solution (Python):
x=int(input())
while(True):
    for i in range(2,x):
        if x%i==0:
            break
    else:
        print(x)
        break
    x+=1

Solution (Python):
p = int(raw_input())

def prime(p):
	k = 2
	while(k ** 2 <= p):
		if p % k == 0:
			return False
		k+=1
	return True

while(True):
	if prime(p):
		print p
		break
	p+=1

Solution (Python):

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)









X=n0()

def primes(n):
    num = [True]*n
    num[0] = num[1] = False
    for i in range(2,int(n**0.5)+1):
        if num[i]:
            for j in range(i**2, n, i):
                num[j] = False
    return [i for i in range(2,n) if num[i]]

sosuu=primes((10**5)+1000)
while True:
    if X in sosuu:
        print(X)
        break
    X+=1