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):
x=int(input())
count=0
for i in range(x,100000000):
  for j in range(2,100000):
    if j!=i:
      if i%j==0:
        count+=1
        break
  if count==0:
    print(i)
    exit()
  else:
    count=0
    continue

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

def make_primes_list(n):
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5+1)):
        primes.difference_update(range(i*2, n+1, i))
    primes=list(primes)
    return primes

P = make_primes_list(100005)

for x in range(X,100005):
    if x in P:
        print(x)
        break

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


MAX_NUM = 1000000000  
X = int(input())

for num in range(X, MAX_NUM):
    if is_prime(num):
        print(num)
        break

Solution (Python):
import math
x = int(input())
'''
逐次探索だとTLE
def check():
    prime_li = [2]
    if x==2:
        return 2
    for i in range(3,x+1,2):
        if all(i%p!=0 for p in prime_li):
            prime_li.append(i)

    for i in range(x+1,10**6):
        if all(i%p!=0 for p in prime_li):
            return i
'''

def get_primeli(x):
    prime_li=[]
    serch_li=list(range(2,x+1))
    while True:
        if serch_li[0]>math.sqrt(x):
            prime_li.extend(serch_li)
            break
        else:
            y = serch_li.pop(0)
            prime_li.append(y)
            serch_li = [n for n in serch_li if n%y!=0]
    return prime_li

prime_li = get_primeli(x)


for n in range(x,10**6):
    if n in prime_li:
        print(n)
        break
    if all(n%p!=0 for p in prime_li):
        print(n)
        break

Solution (Python):
def divisor(x):
    div=[]
    for i in range(1,int(x**(1/2))+1):
        if x%i==0:
            div.append(i)
            if i!=x//i:
                div.append(x//i)
    return sorted(div)


X=int(input())
while True:
    if len(divisor(X))==2:
        break
    else:
        X+=1
print(X)

Solution (Python):


x = int(input())

f = False   
x = x - 1

while f == False:
    x += 1
    
    def judge_prime_num(a:int)->bool:   
        m = int(a**(1/2)+1)
        for i in range(2, m):
            if a % i == 0:
                return False
            else:
                pass
        return True
    f = judge_prime_num(x)


print(x)

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

def 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

for j in range(x,2*x):
    if prime(j)==True:
        print(j)
        sys.exit()

Solution (Python):
import math

X = int(input())

judge = True
while judge:
    flg = 0
    for i in range(2,math.ceil(X/2)):
        if X % i == 0:
            flg = 1
            break
    if flg == 1:
        X +=1
    else:
        judge = False

print(X)

Solution (Python):
import math

X = int(input())

judge = True
while judge:
    flg = 0
    for i in range(2,math.floor(X/2)):
        if X % i == 0:
            flg = 1
            break
    if flg == 1:
        X +=1
    else:
        judge = False

print(X)

Solution (Python):
import math

X = int(input())

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

    return True

while not check(X):
    X += 1

print(X)

Solution (Python):
import math

X = int(input())

def era(n):
    O = [i + 2 for i in range(n-1)]
    P = []
    for i in range(int(math.sqrt(n))):
        P.append(O[0])
        O = [o for o in O if o % P[-1] != 0]
    for o in O:
        P.append(o)
    return P

P = era(2*X)
for i in range(len(P)):
    if X <= P[i]:
        print(P[i])
        break

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

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

while prime(X):
    X += 1
print(X)

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

def prime(x):
    if x == 2:
        return True
    elif x % 2 == 0:
        return False
    elif x > 2:
        for i in range(3, math.floor(math.sqrt(x))+1,2):
            if x % i == 0:
                return False
        return True
while prime(x) != True :
    x += 1
print(x)

Solution (Python):
import math
x = int(input())
def prime_get():
    if x <= 1:
        return []
    prime = [2]
    limit = int(math.sqrt(x))
    data = [i+1 for i in range(2,100004,2)]

    while limit >= data[0]:
        prime.append(data[0])
        data = [j for j in data if j % data[0] != 0]
    return prime+data

ans = prime_get()
ans = [i for i in ans if i >= x]
print(ans[0])

Solution (Python):

import io
import math

data = int(input())

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

for i in range(data, data+100):
  if primos(i):
    print(i)
    exit()

Solution (Python):
def eratosthenes(n):
    l = [i for i in range(2, n + 1)]
    for i in range(2, int(n ** 0.5) + 1):
        l = [j for j in l if j % i != 0 or i == j]
    return l

x = int(input())
l = eratosthenes(2 * (10 ** 5))
for i in l:
    if x <= i:
        print(i)
        exit()

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

def isprime(n):
    if n < 2:
        return False
    elif n == 2:
        return True
    elif n % 2 == 0:
        return False
    for i in range(3, math.floor(math.sqrt(n))+1, 2):
        if n % i == 0:
            return False
    return True

while isprime(X) is not True:
    X += 1

print(X)

Solution (Python):
import bisect
x = int(input())
def eratosthenes(limit):
    A = [i for i in range(2,limit+1)]
    P = []
    time = 0
    while True:
        prime = min(A)
        
        if prime > limit**0.5:
            break
        P.append(prime)
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
    for a in A:
        P.append(a)
    return P
L = eratosthenes(100005)
y = bisect.bisect_left(L,x)
print(L[y])

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

def eratosthenes(x):
  X = int(math.sqrt(x))
  prime = [i for i in range(2,x+1)]
  for _ in range(2,X+1):
    prime = [i for i in prime if i%_!=0 or i==_]
  return prime
prime = eratosthenes(2*10**5)

for i in prime:
  if x<=i:
    print(i)
    exit()

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

def is_prime(c):
  for i in range(2,int(c**(1/2))+2):
    if c%i==0 and c!=2:
      return False
  return True

for i in range(x,100004):
  if is_prime(i)==False:
    pass
  else:
    print(i)
    break

Solution (Python):
x=int(input())
if x==2:
    print(2)
    exit()
for i in range(x,100004):
    for j in range(2,int(i**(1/2))+2):
        if i%j==0:
            break
        if j==int(i**(1/2))+1:
            print(i)
            exit()

Solution (Python):
import math

X = int(input())

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

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

A  = int(input())

j = A
ans = False

while ans == False:
  if is_prime(j) == True:
    print(j)
    ans = True
  else:
    j += 1

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






















def get_prime_number(number):
    prime_list = []

    search_list = list(range(2, number + 1))

    while True:
        if search_list[0] > math.sqrt(number):
            prime_list.extend(search_list)
            break

        else:
            head_num = search_list[0]
            prime_list.append(head_num)

            search_list.pop(0)
            search_list = [num for num in search_list if num % head_num != 0]

    return prime_list


lists = get_prime_number(110000)
max_list = []
for i in lists:
    if i >= X:
        max_list.append(i)

print(min(max_list))

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

for i in range(X,X*2):
    ok=0
    for j in range(2,i):
        if i%j == 0:
            ok += 1
    if ok == 0:
        print(i)
        break

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X = INT()
i = 0
C = True
  
while C:
  for j in range(1,X+i):
    if gcd(j, X+i) != 1:
      i += 1
      break
  else:
    C = False
    
print(X+i)

Solution (Python):
def prime(a):
    for i in range(2,a):
        if a % i == 0:
            return False
    return True

x = int(input())
while prime(x) == False:
    x += 1
print(x)

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

is_prime = [True] * (10**6+1)   
is_prime[0] = False
is_prime[1] = False

for i in range(2,int(10**3)+1):  
    if is_prime[i]:
        for j in range(i * 2, 10**6 + 1, i):
            is_prime[j] = False

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

Solution (Python):
import math

def sieve(n):
    ass = []
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, int(math.sqrt(n))+1):
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    for i in range(n+1):
        if is_prime[i]:
            ass.append(i)
    return(ass)

x = int(input())
ass = sieve(10**5+4)
s = set(ass)
import bisect
if x in s:
    print(x)
else:
    i = bisect.bisect_right(ass, x)
    print(ass[i])

Solution (Python):
import math

def sieve(n):
    ass = []
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, int(math.sqrt(n))+1):
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    for i in range(n+1):
        if is_prime[i]:
            ass.append(i)
    return(ass)

x = int(input())
ass = sieve(10**5+4)
s = set(ass)
import bisect
if x in s:
    print(x)
else:
    i = bisect.bisect_right(ass, x)
    print(ass[i])

Solution (Python):
import math


def using_sqrt(k):
    while True:
        factor = 0  

        
        if k % 2 == 0 and k != 2:
            k += 1
            continue

        
        for divisor in range(2, math.floor(math.sqrt(k))+1):
            if k % divisor == 0:
                factor += 1

        if factor == 0:
            return k

        k += 1


print(using_sqrt(int(input())))

Solution (Python):
import math

X = int(input())


def is_prime_number(number):
    is_dividable = lambda divided, divider: divided % divider == 0
    result = all([not is_dividable(number, divider) for divider in range(2, int(math.sqrt(number)))])

    return result


answer = X
while True:
    if is_prime_number(answer): break
    answer += 1

print(answer)

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


def is_prime_number(number):
    is_dividable = lambda divided, divider: divided % divider == 0
    result = all([not is_dividable(number, divider) for divider in range(2, number)])

    return result


answer = X
while True:
    if is_prime_number(answer): break
    answer += 1

print(answer)

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


def is_prime_number(number):
    result = True
    for divider in range(2, number):
        is_dividable = number % divider == 0
        if is_dividable:
            result = False
            break

    return result


answer = X
while True:
    if is_prime_number(answer): break
    answer += 1

print(answer)

Solution (Python):
import math
from functools import reduce
import itertools

def input1():
	return int(input())


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


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




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


X=input1()
n=10**10

for p in range(X, n):
    if is_prime(p):
    	print(p)
    	break
    else:
    	continue

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

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

while (1):
  if prime(x)==False: x += 1
  else: break
print(x)

Solution (Python):
X=int(input())
def divisors(n):
	a=[]
	for i in range(1,int(n**(1/2))+1):
		if n%i==0:
			if n==i**2:
				a.append(i)
			else:
				a.append(i)
				a.append(n//i)
	return a
ans=0
while X>0:
	if len(divisors(X))==2:
		ans=X
		break
	X+=1
print(ans)

Solution (Python):
import sys
x = int(input())
if x == 2:
    print(2)
    sys.exit(0)
prime = []
prime_dec = True

prime.append(2)

for n in range(3, 1000, 2):
    prime_dec = True
    for primes in prime:
        if primes > n ** 0.5:
            break
        if n % primes == 0:
            prime_dec = False
            break
        else:
            continue
    if prime_dec:
        prime.append(n)

x -= 2
if x % 2 == 0:
    x += 1
prime_disc = True
while prime_disc:
    prime_dec = True
    x += 2
    for primes in prime:
        if primes > x ** 0.5:
            break
        if x % primes == 0:
            prime_dec = False
            break
        else:
            continue
    if prime_dec:
        print(x)
        prime_disc = False

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


def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1


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

Solution (Python):
import math

def prime_check(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())

for i in range(x, 1000000):
    if prime_check(i):
        print(i)
        break

Solution (Python):
import math

def is_prime(n):
    return 1 if n==2 or all([n%i != 0 for i in range(2, math.ceil(math.sqrt(n))+1)]) else 0

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

Solution (Python):
def Sieve_of_Eratosthenes(N):
    if N<2:
        prime = [False for i in range(N+1)]
        return prime
 
    prime = [True for i in range(N+1)]
    prime[0] = False
    prime[1] = False
 
    for i in range(2, int(N**0.5)+1):
        if prime[i]:
            for j in range(i*2, N+1, i):
                prime[j] = False
 
    return prime

prime=Sieve_of_Eratosthenes(10**5+5)
x=int(input())
while prime[x]==False:
    x+=1
print(x)

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 callIsPrime(input_num=1000):
    numbers = []
    
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    
    return numbers


prime_list = callIsPrime(100004)


X = int(input())

for v in prime_list:
    if X<=v:
        print(v)
        break

Solution (Python):

import sys
import numpy as np
import math

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

def solve(X: int):
    while(True):
        if isPrime(X):
            print(X)
            return
        else:
            X+=1

    return



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())

i = X

while 1:
    if i == 2:
        print(2)
        exit()
    if i % 2 == 0:
        pass
    else:
        for j in range(2, i):
            if i % j == 0:
                break

            if j == i-1:
                print(i)
                exit()
    i += 1

Solution (Python):
import math

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

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

Solution (Python):
x = int(input())
for i in range(x,100004):
    if all([i%p!=0 for p in range(2,i)]):
        print(i)
        break

Solution (Python):
X=int(input())
SUP=2*(10**5)
P=[True for i in range(2*(10**5))]
k=2
while k<SUP:
    if P[k]:
        for x in range(2*k,SUP,k):
            P[x]=False
    k+=1
ans=X
while not P[ans]:
    ans+=1
print(ans)

Solution (Python):
x = int(input())
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = 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]]
prime_ls = primes(10**5 + 3)

r = len(prime_ls)- 1
l = -1
while r - l > 1:
    m = (r + l) // 2
    if prime_ls[m] >= x:
        r = m
    else:
        l = m
print(prime_ls[r])

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


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

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

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

ans = X
flag = True
while flag:
    for j in range(2, int(X ** 0.5) + 1):
        if X % j == 0:
            break
    else:
        ans = X
        flag = False
    X += 1

print(ans)

Solution (Python):
import math

X = int(input())
while True:
    check = True
    for i in range(2, math.floor(math.sqrt(X)) + 1):
        if X % i == 0:
            check = False
    if check:
        print(X)
        exit()
    else:
        X += 1

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
mo = 10**9+7

def primes(n):
	is_prime = [True] * (n + 1)
	is_prime[0] = False
	is_prime[1] = 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 is_prime

def main():
	x = II()
	ps = primes(2*10**5)
	for i,n in enumerate(ps[x:],x):
		if(n):
			print(i)
			exit()

if __name__ == '__main__':
	main()

Solution (Python):
x = int(input())
flag = False
for i in range(x, 10**10):
    for j in range(2, x):
        if i % j == 0:
            flag = True
    if not flag:
        print(i)
        exit()
    else:
        flag = False

Solution (Python):
def myAnswer(X:int) -> int:
   while True:
      for i in range(2,X):
         if(X % i==0):
            break
      else:
         return X
      X+=1

def modelAnswer():
   tmp=1
def main():
   X = int(input())
   print(myAnswer(X))

if __name__ == '__main__':
   main()

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

x = INT()

NN = x * 2 + 100
primes = []
isprime = [True for _ in range(NN + 1)]

for i in range(2, NN + 1):
    if not isprime[i]:
        continue
    primes.append(i)
    for j in range(i * 2, NN + 1, i):
        isprime[j] = False

for i in primes:
    if i >= x:
        print(i)
        exit()

Solution (Python):
X = int(input())
if(X%2 == 1 and X >= 6):
  for i in range(10000):
    j = 0
    while((X + 2*i) % (j+3) != 0 and (X + 2*i) > 2*(j+3)):
        j += 2
    if((X + 2*i) % (j+3) != 0):
        print(X + 2*i)
        break

elif(X == 2):
  print(2)

elif(X == 3):
  print(3)

elif(X == 4):
  print(5)

elif(X == 5):
  print(5)

else:
  for i in range(10000):
    j = 0
    while((X + 2*i + 1) % (j+3) != 0 and (X + 2*i + 1) > 2*(j+3)):
        j += 2
    if((X + 2*i + 1) % (j+3) != 0):
        print(X + 2*i + 1)
        break

Solution (Python):

import math

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
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)==True:
            print(x)
            break
        x+=1
if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
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)==True:
            print(x)
            break
        x+=1
if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def prime_list(n):
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5+1)):
        primes-=set(range(i*2, n+1, i))
    return list(primes)
def main():
    x=int(input())
    primes = prime_list(100010)
    for p in primes:
        if p >= x:
            print(p)
            break
if __name__=='__main__':
    main()

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, x + 10 ** 5):
    if is_prime(i):
        print(i)
        exit()

Solution (Python):
x = int(input())
def prime(n):
    if all(n%i !=0 for i in range(2,int(n**(1/2))+1)):
           return True
    else:
           return False
for i in range(x,x**2):
    if prime(i):
        print(i)
        break

Solution (Python):
import math


X = int(input())


def is_prime(x):
    n = math.floor(math.sqrt(x))
    ret = True
    for i in range(n, 1, -1):
        if x % i == 0:
            ret = False
            break
    return ret


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

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

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

    x += 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        

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

Solution (Python):

from math import floor, ceil, sqrt
def isprime(n: int) -> bool:
    """
    Return n is a prime number or not
    """
    tmp = ceil(sqrt(n))
    for i in range(2, tmp + 1):
        if n % i:
            continue
        else:
            return False
    else:
        return True


x = int(input())
if x == 2:
    print(2)
    exit()
for i in range(x, 100004):
    if isprime(i):
        print(i)
        exit()

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


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


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

Solution (Python):
def check_prime(m):
  prime_flag = 1
  counter = 2
  while counter **2 <= m:
    if not m%counter:
      prime_flag = 0
      break
    counter += 1
  return prime_flag


n = int(input())

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

Solution (Python):
import math

x = int(input())

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

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

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

a = X
if (X % 2 == 0) & (X > 2):
	a += 1
while 1:	
	if is_prime(a):
		print(a)
		break
	else:
		a += 2

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

def is_prime(x):
	if x == 2:
		return True
	if x % 2 == 0:
		return False
	else:
		for i in range(3, x, 2):
			if x % i == 0:
				return False
		return True

a = X
if (X % 2 == 0) & (X > 2):
	a += 1
while 1:	
	if is_prime(a):
		print(a)
		break
	else:
		a += 2

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

def prime(x):
    if x==2:
        return 2
    if x==3:
        return 3
    if x%2==0:
        x+=1
    while True:
        boo=False
        for i in range(2,x):
            if x%i==0:
                boo = True
                break
        if boo==False:
            return x
        else:
            x+=2
        

print(prime(x))

Solution (Python):
from math import sqrt
x = int(input())
while x:
    cnt = 0
    for i in range(2, int(sqrt(x)) + 1):
        if x % i != 0:
            cnt += 1
    if cnt == int(sqrt(x)) - 1:
        print(x)
        exit()
    else:
        x += 1

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



def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if(n%i == 0):
            divisors.append(i)
            if(i!= n//i):
                divisors.append(n//i)

    return  divisors

while(True):
    tmp = make_divisors(x)
    if(len(tmp) == 2):
        break
    x += 1

print(x)

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

Solution (Python):
def ifPrine(n):
    if n <= 1:
        return True
    elif n == 2 or n == 3:
        return False
    else:
        i = 2
        while i*i <= n:
            if n % i == 0:
                return True
            else:
                i += 1
    return False

x = int(input())
q = 0
while q < 100000:
    if ifPrine(x+q) == False:
        print(x+q)
        break
    else:
        q += 1

Solution (Python):
x = int(input())
pr = [2]
if x == 2:
    print(2)
else:
    for i in range(3,100009,2):
        fr = 0
        for j in pr:
            if i % j == 0:
                fr += 1
                break
        if fr == 0:
            if i >= x:
                print(i)
                break
            pr.append(i)

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

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