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):
a = int(input())
if a == 2:
    print(2)
    exit()
if a % 2 == 0:
    a += 1
while True:
    count = 0
    for i in range(3,a,2):
        if a % i == 0:
            a += 1
            count += 1
            break
    if count == 0:
        print(a)
        exit()

Solution (Python):


from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt
from fractions import gcd

def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

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

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas


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

X = intinput()

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

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

while not is_prime(X):
    X += 2

print(X)

Solution (Python):
import math

x = int(input())

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

for i in range(x, x+100):
  if is_prime(i):
    print(i)
    exit()

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

i=2
lst=[]
while 1:
    flag=1
    for m in lst:
        if not i%m:
            flag=0
            break
    if flag:
        lst.append(i)
        if i>=X:
            print(i)
            exit()
    i+=1

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

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

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

Solution (Python):
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]]

n=int(input())

for num in primes(10**6):
  if num>=n:
    print(num)
    break

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):
from bisect import bisect_left


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]]


x = int(input())
p = primes(100100)
print(p[bisect_left(p, x)])

Solution (Python):
import math
import sys

X = int(input())
LIM = 100004 
num = [0] * LIM
num[0] = 1
num[1] = 1
if X == 2:
    print(X)
else:
    for i in range(2,X):
        if num[i] == 0:
            k = i
            cnt = 1
            while k <= LIM-1:
                num[k] = 1
                cnt += 1
                k = i*cnt
                



    S = X
    while num[S] == 1:
        S += 1 

    print(S)

Solution (Python):
import os

def main():
    sosu = int(input())
    if sosu == 2:
        print(2)
    else:
        while(checksosu(sosu)):
            sosu += 1
        print(sosu)

def checksosu(num):
    for i in range(3,num,2):
        if num % i == 0:
            return True
    return False
    
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):
  if is_prime(x+i) == True:
    print(x+i)
    break

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

def is_prime(x):
    i = 2
    while i**2 <=x:
        if x % i ==0:
            return False
        i +=1

    return True
  
while is_prime(x)==False:
  x +=1
    
print(x)

Solution (Python):
X = int(raw_input())
 
def check_prime(X):
    import math
    s = int(math.floor(math.sqrt(X)))
    for a in range(2, s+1):
        if X % a == 0:  
            return False
    return True
 
while True:
    if check_prime(X): break
    X += 1
 
print X

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

Solution (Python):
from math import floor,ceil,sqrt,factorial,hypot,log
def read_int(): return int(input())
 
def prime(num):
    for n in range(2,int(sqrt(num))):
        if num % n == 0:
            return False
            break
    return True
  
def solution(K):
    while not prime(K):
        K += 1
    return K
    
K = read_int()
print(solution(K))

Solution (Python):
from math import sqrt
from sys import stdin
X = int(stdin.readline().rstrip())

def is_prime(x):
    if x == 2:
        return True

    if x < 2 or x % 2 == 0:
        return False

    i = 3
    while i <= sqrt(x):
        if x % i == 0:
            return False
        i = i + 2
    
    return True

while not is_prime(X):
    X += 1

print(X)

Solution (Python):

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

    return flag

import math
X = int(input())

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

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

import bisect

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]]

primess = primes(100010)
idx = bisect.bisect_left(primess,x)
print(primess[idx])

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

import math

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

while not isPrime(X):
    X += 1

print(X)

Solution (Python):
import sys
X = int(input())
P = [2]
if X == 2:
    print(2)

    sys.exit()
for i in range(3, 10**6):
    for l in range(len(P)):
        if i % P[l] == 0:
            break
        elif l == len(P)-1 and i >= X:
            print(i)
            sys.exit()
        elif l == len(P)-1:
            P.append(i)

Solution (Python):

import math
import numpy as np

X = int(input())

sieve = np.ones(100004, dtype=np.bool) * True
sieve[0] = False
sieve[1] = False
limit = math.sqrt(100004)

for i in range(2, int(limit)):
    sieve[i*2::i] = False

primes = np.arange(0, 100004)[sieve]
print(primes[primes >= X][0])

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
	
n = int(input())

X = n

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

Solution (Python):
import sys
import math
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

for x in range(X, X * 2):
    if is_prime(x):
        print(x)
        sys.exit(0)

Solution (Python):
import math


def find(X):
    ans = 1
    sq = math.floor(math.sqrt(X))
    for i in range(2, sq + 1):
        if X % i == 0:
            ans = -1
            break
        if i == sq and ans == 1:
            print(X)
            exit()


X = int(input())

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

while True:
    find(X)
    X += 1

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

import math

def is_not_prime(n):
    if n == 1: return True

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

    return False

num = X
while is_not_prime(num):
  num = num+1

print(num)

Solution (Python):
x = int(input())
list = [int(i) for i in range(x, 120000)]
for t in list:
    f = 0
    for i in range(2,x//2):
        i = int(i)
        if t % i == 0:
            
            f = 1
        if f == 1:
            break
    if f == 0:
        print(t)
        break

Solution (Python):
primes = [True] * int(1e6)

for i, v in enumerate(primes):
    if i == 0 or i == 1:
        continue
    if v == True:
        multiple = 2
        while (i)*multiple < len(primes):
            primes[(i)*multiple] = False
            multiple += 1

X = int(input())
for i in range(X, len(primes)):
    if primes[i] == True:
        print(i)
        break

Solution (Python):
import math

def isPrime(y):
  if y == 2 or y == 3:
    return True
  for i in range(2, int(math.sqrt(y)) + 2):
    if y % i == 0:
      return False
  return True
x = int(input())
while not isPrime(x):
  x += 1
print(x)

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,(10**5+10)):
    if is_prime(i)==True:
        print(i)
        break
    else:
        continue

Solution (Python):
import math

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

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

Solution (Python):
def primes(n):
	bool_arr = [True] * (n+1)
	bool_arr[0] = False
	bool_arr[1] = False
	for i in range(2, len(bool_arr)):
		if bool_arr[i]:
			for j in range(i, n//i+1):
				bool_arr[i*j] = False
	return bool_arr

n = 1000000
ans = primes(n)
x = int(input())
for i in range(x, len(ans)):
	if ans[i]:
		print(i)
		break

Solution (Python):
def is_prime(x, i):
  if i*i > x:
    return True
  elif x % i == 0:
    return False
  else:
    return is_prime(x, i+1)
  
def gen_prime(x):
  if is_prime(x, 2):
    return x
  else:
    return gen_prime(x+1)
    
if __name__ == "__main__":
  import sys
  sys.setrecursionlimit(10240)
  x = int(input())
  print(gen_prime(x))

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

n=int(input())

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


print (i)

Solution (Python):
import math

x = int(input())

for j in range(x,10**6):
    flag = True
    for i in range(2,int(math.sqrt(x))+1):
        if j%i == 0:
            flag = False
    if flag:
        print(j)
        break

Solution (Python):
import math

def getPrimes(X):
    primes = []
    limit = math.sqrt(X)
    data = [i + 1 for i in range(1, X)]
    while True:
        p = data[0]
        if limit <= p:
            return primes + data
        primes.append(p)
        data = [d for d in data if d % p != 0]

def getNextPrime(primes, X):
    while True:
        if primes[-1] == X:
            return X
        if any([X % p == 0 for p in primes]):
            X += 1
        else:
            return X
        
X = int(input())
primes = getPrimes(X)
print(getNextPrime(primes, X))

Solution (Python):
import math

def getPrimes(X):
    primes = []
    limit = math.sqrt(X)
    data = [i + 1 for i in range(1, X)]
    while True:
        p = data[0]
        if limit <= p:
            return primes + data
        primes.append(p)
        data = [d for d in data if d % p != 0]

def getNextPrime(primes, X):
    while True:
        if any([X % p == 0 for p in primes]):
            if primes[-1] == X:
                return X
            X += 1
        else:
            return X
        
        
X = int(input())
primes = getPrimes(X)
print(getNextPrime(primes, X))

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

Solution (Python):
import sys

x=int(input())
table=[True]*200000

for i in range(2,200000):
	if table[i]:
		if i>=x:
			print(i)
			sys.exit()
		for j in range(i*2,200000,i):
			table[j]=False

Solution (Python):
def is_prime(n: int) -> bool:
    for i in range(2, n):
        if n % i == 0:
            return False
    return True


def smallest_prime_above_n(n: int) -> int:
    prime_candidate = n
    while True:
        if is_prime(prime_candidate):
            return prime_candidate
        prime_candidate += 1


X = int(input())
print(smallest_prime_above_n(X))

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

while 1:
  count = 0
  for i in range(n+1):
    if i == 0:
      continue
    if n%i == 0:
      count += 1
  if count == 2:
    break
  n += 1
print(n)

Solution (Python):
import math
X = int(input())
XX = 2 * X
data = [i for i in range(2,XX+1)]
limit = math.sqrt(XX)
prime = []
while True:
    p = data[0]
    if limit <= p:
        prime = prime + data
        break
    prime.append(p)
    data = [e for e in data if e % p != 0]
lenp = len(prime)
for i in range(lenp):
    if prime[i] >= X:
        print(prime[i])
        break

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

Solution (Python):
import math

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

num = int(input())

loop = True
while(loop):
    is_next_prime = trial_division(num)
    if is_next_prime == True:
        print(num)
        loop = False
    num += 1

Solution (Python):
def is_prime(n):
    i=2
    while i*i<n:
        if n%i==0:
            return False
        i+=1
    return True 

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

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

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

for x in range(X,X*10):
  if is_prime(x):
    print(x)
    exit()

Solution (Python):
import numpy as np
import sys

X = int(input())
if X == 2 or X == 3:
    print(X)
    sys.exit()

while 1:
    for i in range(2, int(np.sqrt(X) + 1) ):
        if X % i == 0 :
            break

        if i+1 == int(np.sqrt(X) + 1 ):
            print(X)
            sys.exit()
    
    X += 1

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

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

Solution (Python):
import sys

x = int(input())
result = x
while True:
  flag = False
  for i in range(2,result+1):
    if result % i == 0:
      break
  if i == result:
    print(result)
    sys.exit()
  result+=1

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

import math

while True:
  is_prime = True
  for i in range(2, int(math.sqrt(x))+1):
    if x % i == 0:
      is_prime = False
  if is_prime:
    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())  

for i in range(X,10**6):
  if is_prime(i):
    print(i)
    exit()

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


while 1:
    prime_dc = 0
    for i in range(2,n):
        if n % i != 0:
            prime_dc += 1
            
    if n-2 == prime_dc:
        break
    
    n += 1

print(n)

Solution (Python):
import math

def create_arr(n):
  prime = {i for i in range(2,n)}
  for i in range(2,n):
    if i in prime:
        for j in range(i*2,n,i):
            if j in prime:
                prime.remove(j)
  return prime

def search(x):
  root = math.floor(math.sqrt(float(x)))
  prime_arr = create_arr(root)
  
  for num in prime_arr:
    if int(x) % num == 0:
      return search(int(x)+1)
  print(x)

X = input()
search(X)

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

from math import sqrt

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

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

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

if is_prime(s) == True:
    print(s)
while is_prime(s) == False:
    s = s +1
    if is_prime(s) == True:
        print(s)
        break

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

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

print(X)

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 True:
    if is_prime(x):
        print(x)
        break
    x += 1

Solution (Python):
import math 
n=int(input())
f=0
if(n==2):
    print(2)
else:
    if(n%2==0):
        n=n+1
    while(f==0):
        k=math.sqrt(n)
        k=math.ceil(n)
        l=0
        for i in range(2,k):
            if(n%i==0):
                break
            else:
                l=l+1
        if(l==k-2):
            f=1
            print(n)
        else: 
            n=n+2

Solution (Python):
from math import sqrt

N = 10 ** 6

p = [True] * (N + 1)
p[0] = False
p[1] = False
n = int(sqrt(N) + 1)
for j in range(4, N + 1, 2):
  p[j] = False
for i in range(3, n + 1, 2):
  if p[i]:
    for j in range(i + i, N + 1, i):
      p[j] = False


X = int(input())
for i in range(X, N + 1):
    if p[i]:
        print(i)
        break

Solution (Python):
def prime(n):
  prime_table = [2]
  for i in range(3,n+1):
    f = 1
    for j in prime_table[:bisect.bisect_right(prime_table,int(i**0.5))]:
      if i % j == 0:
        f = 0
        break
    if f:
      prime_table.append(i)
  return prime_table

import bisect
x = int(input())
pt = prime(5*10**5)
print(pt[bisect.bisect_left(pt,x)])

Solution (Python):
import math

def prime(num):
    count = 0
    for i in range(2, math.floor(math.sqrt(num)) + 1):
        if num == 2:
            break
        if i % 2 == 0 and i != 2:
            continue
        if X % i == 0:
            count += 1

    if count == 0:
        return True
    else:
        return False


X = int(input())

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

Solution (Python):
int_a = int(input())
root_a = int(int_a ** 0.5)
if int_a <= 3:
    print(int_a)
else:
    for b in range(int_a, int_a + 1000):
        flag = True
        for c in range(2, root_a + 2):
            if b % c == 0:
                flag = False
                break
        if flag:
            print(b)
            break

Solution (Python):
s = input().split()
a = int(s[0])-1
t=0
def hantei(x):
    i=2
    while i*i < a:
        if x % i == 0:
            return 0
        i += 1
    return 1
while t<1:
    a += 1
    t=hantei(a)
print(a)

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(not is_prime(X)):
    X += 1
print(X)

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

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

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

Solution (Python):
def is_prime(n):
    for p in range(2,n):
        if n % p ==0:
            return True

n =int(input())
m=n
while m <10**7:
    if is_prime(m):
        m +=1
    else:
        print(m)
        break

Solution (Python):

X = int(input())

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

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

print(X)

Solution (Python):
s = int(input())
if s <= 2:
  print(2)
  exit()
elif s <= 3:
  print(3)
  exit()
elif s <= 5:
  print(5)
  exit()

while True:
  for i in range(2,s // 2):
    if s % i == 0:
      break
  if i == s //2 -1:
    print(s)
    exit()
  s += 1

Solution (Python):

inputA = int(input())

flag = 0
for count in range(inputA,300000):

    for mod in range(2,200000):
        if count % mod == 0:
            flag = mod
            break
        mod += 1
    if count == flag:
        print(count)
        break
    elif flag == 0:
        print(inputA)
    else:
        count += 1

Solution (Python):
X = int(input())
if X > 2 and not X % 2: X += 1

while True:
    i = 3

    f = True
    while i ** 2 <= X:
        if not X % i:
            f = False
            break
        i += 2
        
    if f and X > 1: break

    X += 2
    
print(X)

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

def get_is_prime(x):
  if x <= 1:
    return False
  for i in range(2, x):
    if i ** 2 >= x:
      break
    if x % i == 0:
      return False
  return True

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

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

f3 = False
while f3 != True:
    if n1 == 1:
        break
    if n1 == 2:
        break
    for i2 in range(1, int(math.sqrt(n1))):
        if n1 % (i2 + 1) == 0:
            n1 += 1
            break
        elif i2 + 1 == int(math.sqrt(n1)):
            f3 = True
            break
print(n1)

Solution (Python):
s = int(input())
if s <= 2:
  print(2)
  exit()
elif s <= 3:
  print(3)
  exit()
elif s <= 5:
  print(5)
  exit()

while True:
  for i in range(2,s // 2):
    if s % i == 0:
      break
  if i == s //2 -1:
    print(s)
    exit()
  s += 1

"""
prime_data = [2,3,5]

for i in range(3,10**5):
  tmp = int(i//2)
  for j in range(2,tmp):
    if i % j == 0:
      break
    if j == tmp-1:
      prime_data.append(i)
print(prime_data)
"""

Solution (Python):
x = int(input())
def search(y):
    for i in range(2, y//2):
        if y % i == 0:
            break
    else:
        return True
    
    return False

while 1:
    ans = search(x)
    if ans:
        print(x)
        break
    x+=1

Solution (Python):
from math import sqrt

X = int(input())
not_finded = True
X = X+1 if (X%2 == 0) and X != 2 else X 

def is_prime(X):
    flag = True
    for i in range(3, int(sqrt(X))+1):
        if X % i == 0:
            flag = False
    return flag

while (not_finded):
    if is_prime(X):
        not_finded = False
        print(X)
    else:
        X += 2

Solution (Python):
def prime(x):
  max_x = (x ** (1 / 2)) // 1
  ans = 1
  for i in range(2, int(max_x) + 1):
    if x % i == 0:
      ans = 0
  return ans

if __name__ == "__main__":
  n = int(input())
  ans = 0
  while ans == 0:
    ans = prime(n)
    if ans == 0:
      n += 1
  print(n)

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

lp = [0] * 1000005
for i in range(2, 100005):
    if lp[i] == 1:
        continue
    if x <= i:
        print(i)
        break

    k = i*i
    while k < 1000005:
        lp[k] = 1
        k += i

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

if X == 1 or X==2:
  print(2)
  sys.exit()

while(True):
  flg = True
  if X%2 == 0:
    X += 1
    continue
    
  for i in range(3,X):
    if X%i == 0:
      flg = False
      
  if flg is True:
    print(X)
    sys.exit()

  X += 2

Solution (Python):
def isPrime(n):
    if n < 2:
    
        return False
    if n == 2:
    
        return True
    for p in range(2, n):
      if n % p == 0:
        
        return False
    
    return True

if __name__ == "__main__":
    n = int(input())
    while True:
        if isPrime(n):
            print(n)
            break
        else:
            n += 1

Solution (Python):
x = int(input())
m = 2 * x

sieve = [True for _ in range(m+1)]

p = 2
i = 2
while True:
    if p * p >= m:
        break
    while p * i <= m:
        sieve[p * i] = False
        i += 1
    p += 1
    while not sieve[p]:
        p += 1
    i = 2

for i in range(x, m):
    if sieve[i]:
        print(i)
        break

Solution (Python):
def is_not_primary(x):
    bln = False
    for i in range(2, x):
        if x % i == 0:
            bln = True
        else:
            continue
    return bln

def main():

    X = int(input())
    start = X
    while is_not_primary(start):
        start += 1
    else:
        print(start)

if __name__ == "__main__":
    main()

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

def sosu(x):
  for i in range(2,x-1):
    if x % i == 0:
      return False
  return True

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

print(x)

Solution (Python):
import math

def isPrime(n):
    if n == 1: return False
 
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
 
    return True
  
num = int(input())
 
res = True
ans = 0
if num > 2 and num%2 == 0:
  num += 1
while(res):
  if isPrime(num):
    print(num)
    break
  num += 2

Solution (Python):
import math

def resolve():
    X = int(input())

    if X == 2:
        print(2)
        return

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

    while True:
        isPrime = True
        for j in range(3, int(math.sqrt(i)), 2):
            if i % j == 0:
                isPrime = False
                break        
        if isPrime:
            print(i)
            return
        i += 2


if __name__ == "__main__":
    resolve()

Solution (Python):
def pri():
    x=input().rstrip()
    x=int(x)
    k=2
    while k<x:
        a=x%k
        if a==0:
            x+=1
            k=2
        else:
            k+=1
    print(x)
pri()

Solution (Python):
import math
 
X=int(input())
ans = X
 
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

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

Solution (Python):
from functools import lru_cache
 
@lru_cache(maxsize=100000)
def n_th_prime(n):
    if n == 0:
        return 2
    primes = [n_th_prime(k) for k in range(n)]
    k = 1
    x = primes[-1] + 1
    while True:
        for p in primes[:k]:
            if x % p == 0:
                x += 1
                break
        else:
            if x > p**2:
                k += 1
            else:
                return x

x = int(input())

k = 0
p = 2
while True:
    for i in range(k):
        p = n_th_prime(i)
        if x % p == 0:
            x += 1
            break
    else:
        if x > p**2:
            k += 1
        else:
            print(x)
            break

Solution (Python):
import math

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


x = int(input())

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

print(x)

Solution (Python):
import math

X = int(input())
x = int(round(math.sqrt(X), 0))
flag = 0

for i in range(100):
    for j in range(2, x):
        if X % j == 0:
            flag = 1
            break
    if flag == 0:
        break
    else:
        flag = 0
        X += 1
print(X)

Solution (Python):
import math

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

N = int(input())
while True:
  if isPrime(N):
    break
  N += 1
  
print(N)

Solution (Python):
x = int(input())
while True:
    k = 2
    flg = True
    while x > k**2:
        if x%k == 0:
            flg = False
            break
        k+= 1
    if flg == True:
        break
    x+=1
print(x)

Solution (Python):
X = int(input())
LEN = int(1e6)
p = [True] * LEN

p[0] = False
p[1] = False

for i in range(LEN):
  if p[i]:
    if i >= X:
      print(i)
      exit()
      
    for j in range(i * 2, LEN, i):
      p[j] = False

Solution (Python):
X = int(input())
LEN = int(1e6)
p = [True] * LEN

p[0] = False
p[1] = False

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

for i in range(X, LEN):
  if p[i]:
    print(i)
    exit()

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

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

Solution (Python):
import math
N=int(input())
def isp(N):
  if N==2:
    return(True)
  k=int(math.sqrt(N))
  
  for i in range(2,k+2):
    if N%i==0:
      return(False)
  return(True)
while isp(N)==False:
  N+=1
print(N)

Solution (Python):

 
import math
import itertools
import sys
import copy
 






X = int(input())

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

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

Solution (Python):
import math

X = int(input())

def primeNum(target):
    dest = int(math.sqrt(target))
    for i in range(2, dest):
        if target % i == 0:
            primeNum(target + 1)
            return
    print(str(target))

primeNum(X)

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

def isprime(n):
    if n < 2:
    
        return False
    if n == 2:
    
        return True
    for p in range(2, n):
        if n % p == 0:
            break
    else:
        return True  

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

print(X)

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
N = int(input())
while True:
    if is_prime(N):
        print(N)
        exit()
    N += 1

Solution (Python):
from math import sqrt

X = int(input())

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

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

print(ans)

Solution (Python):
x=int(input())
def judge(x):
    n=int(x**0.5)
    count=0
    while count==0:
        for i in range(2,n+2):
            if x%i==0:
                x+=1
                count=0
                break
            else:
                count=1
        
        if count==1:
            print(x)
if x==2:
    print(2)
else:
    judge(x)

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

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