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

d = 2

ans = 2

if x != 2:
  while d <= 1+x//2:
    if x%d == 0:
      x += 1
      d = 2
    else:
      if d == 1+x//2:
        ans = x
        break
      else:
        d += 1
  print(ans)
else:
  print(ans)

Solution (Python):

import math


def prime(n):
    if n == 2:
        return True
    elif (n < 2) or (n % 2 == 0):
        return  False
    else:
        i = 3
        while i <= math.sqrt(n):
            if n % i == 0:
                return False
            i += 2

        return True

if __name__ == "__main__":
    x = int(input())
    num = x

    while prime(num) == False:
        num += 1

    print(num)

Solution (Python):
x = int(input())
while True:
    if all(x % i != 0 for i in range(2, x)):
        print(x)
        exit()
    else:
        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():
    n = int(input())
    for k in range(n, n*n, 1):
        if is_prime(k):
            print(k)
            break

if __name__ == '__main__':
    main()

Solution (Python):
import math

X = int(input())

R = X
LL = int(math.sqrt(X)) + 1

found = False
while not found:
    bflag = False
    for i in range(2, LL + 1):
        if R % i == 0 and R != i:
            R += 1
            bflag = True
            break
    found = not bflag

print('{}'.format(R))

Solution (Python):


x = int(input())
min_sosu = x
flg_found = False

for i in range(x, 1000000):
    for j in range(2, i*i):
        if i%j == 0 and j < x:
            break
        if i%j == 0 and j >= x and i == j:
            min_sosu = i
            flg_found = True
            print(min_sosu)
            break
    if flg_found:
        break

Solution (Python):

import math


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


def main():
    n = int(input())
    for i in range(n, 100004):
        if is_prime(i):
            print(i)
            break


if __name__ == '__main__':
    main()

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

n=int(input())
while True:
  if prime(n):
    print(n)
    break
  n+=1

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

if a==2:
    print(2)
elif a==3:
    print(3)

elif a%2==0:
    k=0
    a-=1
    while k==0:
        a+=2
        count=0
        for i in range(2,a//2 + 1):
            if a%i!=0:
                count+=1
        if count==a//2 - 1:
            k=1
    print(a)
elif a%2!=0:
    k=0
    a-=2
    while k==0:
        a+=2
        count=0
        for i in range(2,a//2 + 1):
            if a%i!=0:
                count+=1
        if count==a//2 - 1:
            k=1
    print(a)

Solution (Python):
def isPrime(n):
    for i in range(2,n):
        if n%i == 0:
            return False
    return True
X = int(input())
res=0
if X == 2:
    pass
elif X%2 == 0:
    X = X +1
else:
    pass
for i in range(X, X+10000):
    res = i
    if isPrime(i):
        break
print(res)

Solution (Python):
import math
def trial_division(tar):
	dest  = int(math.sqrt(tar))+1
	for i in range(2,dest):
		if tar%i == 0:
			
			return int(0) 
	return int(1) 

x = int(input())
while trial_division(x)==0:
	x+=1
print(x)

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

def isprime(x):
    for i in range(2,int(x),1):
        if x % i == 0:
            return False
    return True
i = X
while True:
    if isprime(i):
        break
    else:
        i += 1

print(i)

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

import math

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

while 1:
    trial_division(x)
    x+=1

Solution (Python):
import math
x=int(input())
primemode = True
while primemode:
  sos = True
  for n in range(math.floor(math.sqrt(x))):
    if n+1 != 1:
      if x%(n+1) == 0:
        sos = False
  if sos:
    primemode = False
  else:
    x = x+1
print(x)

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

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

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

import math

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

while 1:
    trial_division(x)
    x+=1

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


def isprime(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0:
        return False
    i = 3
    while i <= x ** 0.5:
        if x % i == 0:
            return False
        i += 2
    return True


a = n
while not isprime(a):
    a += 1
print(a)

Solution (Python):
x = int(input())
p = x - 1
prime = False

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

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

def isprime(x):
  for i in range(2, int(x**0.5), 1):
    if x % i == 0:
      return False
  return True
  
while 1:
  if( isprime(x)):
    break
  else:
    x+=1
print(x)

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

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

i = n
while True:
    if isprime(i):
        break
    else:
        i += 1
print(i)

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

answer=0
base=X
a=0

if X==2:
    print(2)
else:
    while a==0:
        for i in range(base//2):
            if base%(i+2)==0:
                base+=1
                break
            else:
                if i==base//2-1:
                    print(base)
                    a+=1
                    break

Solution (Python):
import sys
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

n = int(read())

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 i in range(n, n*n, 1):
    if is_prime(i):
        break

print(i)

Solution (Python):


X=int(input())

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

Solution (Python):
import sys
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

n = int(read())

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 i in range(n, n*n, 1):
    if is_prime(i):
        print(i)
        break

Solution (Python):
x = int(input())
num = 100200
arr = list(range(2,num))
arr = set(arr)
primes = {2}
floor = int(num**0.5)+2

prime = min(arr)
while prime < floor:
    prime = min(arr)
    primes.add(prime)
    nonprime = {prime * i for i in range(1,num//prime + 2)}
    arr = arr.difference(nonprime)

primes = primes.union(arr)

sol = {i for i in primes if i >= x}

print(min(sol))

Solution (Python):
import math
def main():
    X = int(input())
    if X == 2:
        print(X)
        return
    if X % 2 == 0:
        X = X + 1
    while True:
        if trial_division(X):
            print(X)
            break
        X += 2
def trial_division(t):
    d = int(math.sqrt(t))
    for i in range(2, d):
        if t % i == 0:
            return False
    return True
main()

Solution (Python):
import math
x = int(input())
prime = []
sarch = [i for i in range(2, 10 ** 6 + 1)]
while True:
    if (sarch[0] > math.sqrt(x)):
        prime.extend(sarch)
        for i in prime:
            if i >= x:
                print(i)
                exit()
    else:
        head = sarch[0]
        prime.append(head)
        sarch.pop(0)
        sarch = [num for num in sarch if num % head != 0]

Solution (Python):
def main():
    X = int(input())
    primes = [2, 3, 5, 7, 9, 11, 13]
    if X <= primes[-1] and X in primes:
        return X
    while True:
        for i in primes:
            if X % i == 0:
                break
        else:
            for i in range(primes[-1] + 2, int(X ** 0.5) + 1, 2):
                if X % i == 0:
                    break
            else:
                return X
        X += 1 

print(main())

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

is_prime_num_list = [True] * 100005
is_prime_num_list[0] = False
is_prime_num_list[1] = False

for i in range(2, X + 1):
    if is_prime_num_list[i] == True:

        
        for j in range(2 * i, 100005, i):
            is_prime_num_list[j] = False

prime_num_list = [i for i, j in enumerate(is_prime_num_list) if i >= X and j == True]

print(min(prime_num_list))


'''
if is_prime_num_list[X] == True:
    print(X)
    exit()
'''

'''
while True:
    X += 1
    is_target = True
    for i in prime_num_list:
        if X % i == 0:
            is_target = False
            break

    if is_target:
        print(X)
        exit()
'''

Solution (Python):
s = [True for i in range(200000)]
s[0] = False
s[1] = False
n = int(input())
for i in range(2,len(s)):
  if not s[i]:
    continue
  for j in range(i+i, len(s), i):
    s[j] = False
for i in range(n, len(s)):
  if s[i]:
    print(i)
    break

Solution (Python):

import math
import sys
input = sys.stdin.readline

X = int(input())

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

while not is_prime(X):
    X += 1

print(X)

Solution (Python):

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


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

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

Solution (Python):
def is_prime(num):
  for i in range(2, num):
    if num % 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())
p=x-1
prime=False
if x==2:
    print(2)
else:
    while prime==False:
        p+=1
        prime=True
        
        for i in range(2,p-1):
            if p%i==0:
                prime=False
        
        
   
    print(p)

Solution (Python):
import math

def prime_serch(num):
  num_p = int(math.sqrt(num))
  prime = 1
  for n in range(2, num_p):
    if num % n == 0:
      prime = 0
      break
  return prime


num = int(input())
n = 0
while n == 0:
  if prime_serch(num) == 1:
    n = 1
  num += 1
print(num - 1)

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

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

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

count = 0

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

Solution (Python):
from math import sqrt


def is_prime(n):
    for i in range(2, int(sqrt(n))+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):
def hantei(X):
      if X <= 1:
          return False
      for i in range(2, int(X**0.5)):
          if X%i == 0:
              return False
      return True

X = int(input())

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

Solution (Python):
import bisect
import math

def get_primenumber(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

l = get_primenumber(100100)
a = int(input())
t = l[bisect.bisect_right(l,a)]
T =  l[bisect.bisect_left(l,a)]

if T == a:
    print(a)
else:
    print(t)

Solution (Python):
def prm(x):
  if x == 1 or x == 4:
    return False
  for i in range(2,int(x**0.5+1)):
    if x%i == 0:
      return False
  return True
X=int(input())
for i in range(X,X**2):
  if prm(i):
    print(i)
    break

Solution (Python):
def getprime(n):
    if not isinstance(n, int):
        raise TypeError("Input int")
    if n < 2:
        raise ValueError("N >= 2")
    prime = []
    
    data = [i+1 for i in range(1,n)]
    while True:
        p = data[0]
        if p >= int(n**0.5):
            return prime+data
        prime.append(p)
        
        data = [d for d in data if d%p != 0]

X = int(input())
ps = getprime(X*2)
print(min([p for p in ps if p >= X]))

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

l=sieve(100057)
x=int(input())
while True:
    if l[x]==True:
        print(x)
        sys.exit()
    x+=1

Solution (Python):
def P(n):
    if type(n)!=int:raise TypeError
    if n<1:raise ValueError
    if n==1:return -1
    if n%2==0and n!=2:return 2
    a=3
    while a*a<n:
        if n%a==0:return a
        a+=2
    return 0
import math
a=int(input())
while P(a):a+=1
print(a)

Solution (Python):
import math

x = int(input())

def is_prime(n):
    if n <= 1:
        return False

    i = 2
    max_n = int(math.sqrt(n))
    while i <= max_n:
        if n % i == 0:
            return False
        i += 1
    return True
    
def next_prime(n):
    while True:
        if is_prime(n):
            return n
        n += 1

print(next_prime(x))

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 
input=lambda:sys.stdin.readline().rstrip()
def prime(n):
    if(n<=1): return []
    S=[1]*(n+1)
    S[0]=0; S[1]=0
    for i in range(2,n):
        if(S[i]==0): continue
        for j in range(2*i,n+1,i): S[j]=0
    return [p for p in range(n+1) if(S[p])]

def resolve():
    x=int(input())
    P=prime(2*10**5)
    for p in P:
        if(p>=x):
            print(p)
            return
resolve()

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):
from math import sqrt

primes=[2]
flag = False
x = int(input())
if x == 2:
  print(x)
else:
  i = 3
  while True:
    for p in primes:
      if sqrt(i) < p:
        flag = True
        break
      if i % p == 0:
        break
    if flag:
      primes.append(i)
      if x <= i:
        break
      flag = False
    i+=1
  print(i)

Solution (Python):
import math
import os
n = int(input())
i = 3
data = [2]
if n is 2:
  print(n)
else:
  while True:
    flag = True
    for d in data:
      if d > math.sqrt(i):
        break
      elif i % d == 0:
        flag = False
        break
    if flag:
      if i >= n:
        break
      data.append(i)
    i += 2
  print (i)

Solution (Python):
import random


def is_prime(q, k=50):
    q = abs(q)
    
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False

    
    d = (q-1) >> 1
    while d & 1 == 0:
        d >>= 1

    
    for i in range(k):
        a = random.randint(1, q-1)
        t = d
        y = pow(a, t, q)
        
        while t != q-1 and y != 1 and y != q-1:
            y = pow(y, 2, q)
            t <<= 1
        if y != q-1 and t & 1 == 0:
            return False
    return True

X = int(input())

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

Solution (Python):
import sys
bbn=1000000007
	


def is_p(v):
	for i in range(2, int(v**0.5)+1):
		if v % i == 0:
			return False
	return True
						
def main():
	x = int(input())
	x=x-1
	while True:
		x+=1
		if is_p(x):
			return x
	

isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

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

import math

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

    print(n)
    exit()

while True:
  is_prime(a)
  a+=1

Solution (Python):
import copy

n = int(input())

for i in range(n, n + 1000):
  flag = True
  for j in range(2, i - 1):
    if i % j == 0:
      flag = False
      break
  if flag:
    break

print(i)

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

for i in range(10**5):
    if is_prime(x+i) == True:
        print(x+i)
        break
    else:
        continue

Solution (Python):
a = int(input())
z = a
divide = [i for i in range(2, a) if i % 2 != 0]
divide.append(2)
divide.sort()

if a == 2:
  print(2)
  
else:
  while 1 == 1:
    for i in divide:
      start = i
      if a % i == 0:
        a += 1
        break
    if start >= z-3:
      break  
  print(a)

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

num = int(input())

for i in range(num,100004):
  if isPrime(i):
    print(i)
    break

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

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

Solution (Python):
x = int(input())
while True:
    if x == 2:
        break
    if x % 2 != 0:    
        for m in range(3,int(x**0.5) + 4 ,2):
            if x % m == 0 and x > m:
                break
        else:
            break
    x += 1
print (x)

Solution (Python):
import math
def get_primenumber(number):
    prime_list = []
    search_list = list(range(2,10**6+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

x = int(input())
h = get_primenumber(x)
for i in h:
    if i >= x:
        print(i)
        exit()

Solution (Python):
import math

X = int(input())
val = X
max_value = int(math.sqrt(val))

div_list = []
for x in range(2, max_value+1):
    for div in div_list:
        if x % div == 0:
            break
    else:
        div_list.append(x)

while True:
    for div in div_list:
        if val % div == 0:
            break
    else:
        print(val)
        break
    val += 1

Solution (Python):
def check(num):
    if num > 1:
        for i in range(2, num):
            if (num % i) == 0:
                return False
                break
        else:
            return True
    else:
        return False


a = int(input())

for i in range(a, 100500):
    if check(i):
        print(i)
        break

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

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

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

Solution (Python):

X = int(input())
count = 0


for i in range(100000):
    for j in range(2,X):
        if X % j == 0:
            count = count + 1
            break
    if count == 0:
        break
    count = 0
    X = X + 1

print(X)

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

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

Solution (Python):
import math
import sys

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

s = int(input())
a = False
while a == False:
  bb = is_prime(s)
  if bb == True:
    print(s)
    sys.exit()
  else:
    s += 1

Solution (Python):
import random

def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False

    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1

    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)

        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1

        if y != n - 1 and t & 1 == 0:
            return False

    return True

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

Solution (Python):
import math

k = int(input())

ans = 0

while ans == 0:
    factor = 0
        
        
    if k % 2 == 0 and k != 2:
        k +=1
        continue
        
        
    for divisor in range(2, k//2):
        if k % divisor == 0:
            factor += 1
                
    if factor == 0:
        ans =k
    
    k +=1    
            
print(ans)

Solution (Python):

import math


def sosuu(target):

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


def main():

    i = int(input())

    while True:
        if sosuu(i):
            print(i)
            break
        else:
            i += 1

    return 0

if __name__ == '__main__':
    main()

Solution (Python):
a=int(input())
if a==2:
  print(a)
else:
  sosuu=1
  a=a-1
  while sosuu==1:
    a+=1
    b=2
    while a!=b:
      if a%b==0:
        sosuu=1
        break
      else:
        b+=1
        sosuu=0
  print(a)

Solution (Python):
def func(q,k=100):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    for i in range(3,k):
        x,y = q,i
        while y:
            x, y =  y, x % y
        if x != 1: continue
        if pow(i, q-1, q) != 1:
            return False
    return True
n=int(input())
while True:
    if func(n):
        break
    n=n+1
print(n)

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

def mark(s, x):
    for i in range(x + x, len(s), x):
        s[i] = False

def sieve(n):
    s = [True] * n
    for x in range(2, int(n**0.5) + 1):
        if s[x]: mark(s, x)
    return [i for i in range(0,n) if s[i] and i >= a]

s = sieve(a * 2)
print(s[0])

Solution (Python):
x = int(input())
ps = set(range(x, 4 * x + 1))
for i in range(2, x):
    for j in range(0, 4 * x + 1, i):
        if j in ps:
            ps.remove(j)
print(min(ps))

Solution (Python):
from math import sqrt, ceil

X = int(input())

temp = [True]*(10**5+4)
temp[0] = temp[1] = False
for i in range(2, ceil(sqrt(10**5+4))):
    if temp[i]:
        temp[i+i::i] = [False]*(len(temp[i+i::i]))
for j in range(X, 10**5+4):
    if temp[j] == True:
      print(j)
      exit()

Solution (Python):
def isPrime(n): 

	if n <= 1: 
		return False

	for i in range(2, n): 
		if n % i == 0: 
			return False; 

	return True

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

Solution (Python):
def isPrime(n): 

	
	if n <= 1: 
		return False

	
	for i in range(2, n): 
		if n % i == 0: 
			return False; 

	return True

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

Solution (Python):

import math


def isprime(target):

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


def main():

    i = int(input())

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

    return 0

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())
c=0
for k in range(x,100004):

  if is_prime(k) == 1:
    print(k)
    break

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

if X < 4:
  print(X)
  sys.exit()

if X%2 ==0:
  A = X-1
else:
  A = X-2

ans = 0
while ans == 0:
  A += 2
  for n in range(2,int(A/2)+1):
    ans = A
    if A%n == 0:
      ans = 0
      break

ans = A
print(ans)

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

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

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

Solution (Python):
x = int(input())
if x <= 3:
  n = x
elif x == 4:
  n = 5
else:
  n = x
  j = 0
  while j == 0:
    a = int(n/2) + 1
    i = 2
    while i < a:
      if i == a-1:
        j = 1
        i = a
      elif n % i != 0:
        i += 1
      else:
        i = a
        n += 1
print(n)

Solution (Python):
X = int(input())
while X != 'prime':
    for i in range(2,X):
        if X%i == 0:
            break
    else:
        break
    X+=1

            
print(X)

Solution (Python):


import sys
import math
import itertools

debug = False

def log(text):
    if debug:
        print(text)


def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        
        
        
        lines.append(input())

    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    x = [int(e) for e in lines[0].split(" ")][0]

    return (x, )


def solve(x):

    primes = set()

    def is_prime(n):
        
        if n in primes:
            return True

        if n == 1:
            return False

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

        return True

    y = x
    result = 0
    while True:
        if is_prime(y):
            result = y
            break
        else:
            y = y + 1

    return result

def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

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


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

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

print(x)

Solution (Python):
import sys
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:
        return False
  return True

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

Solution (Python):
import math
X = int(input())
if X ==2:
    print(2)
    exit()
elif X%2 == 0:
    X += 1
X -= 2
while True:
    X +=2
    for i in range(2,math.ceil(X**0.5)):
        if X%i ==0:
            break
    else:
        print(X)
        exit()

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

    return True
  
temp = int(input())
while not isPrime(temp):
  temp += 1
print(temp)

Solution (Python):

import math


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


def main():
    n = int(input())
    for i in range(n, 100004):
        if is_prime(i):
            print(i)
            break


if __name__ == '__main__':
    main()

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


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


for i in range(X*2+1):
    num = X + i
    if isPrime(num):
        break

print(num)

Solution (Python):

import math
import sys
input = sys.stdin.readline

X = int(input())

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

def segment_sieve(a,b):
    ass = []
    is_prime_small = [True] * (int(b**0.5)+1)
    is_prime = [True] * (b-a)
    for i in range(2,int(b**0.5)):
        if is_prime_small[i]:
            j = 2*i
            while j**2 < b:
                is_prime_small[j] = False
                j += i
            j = max(2*i,((a+i-1)//i)*i)
            while j < b:
                is_prime[j-a] = False
                j += i
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(a+i)
    if ass[0] == 1:
        del ass[0]
    return ass

list = segment_sieve(X,100004)
res = list[0]

print(res)

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

for i in range(X, 100004, 1):
  if is_prime(i):
    ans = i
    break

print(ans)

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