Problem:
 Score: 300 points    Problem Statement  Find the minimum prime number greater than or equal to X .      Notes  A prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.  For example, 2 , 3 , and 5 are prime numbers, while 4 and 6 are not.      Constraints   2 \le X \le 10^5  All values in input are integers.         Input  Input is given from Standard Input in the following format:  X       Output  Print the minimum prime number greater than or equal to X .        Sample Input 1 20      Sample Output 1 23  The minimum prime number greater than or equal to 20 is 23 .       Sample Input 2 2      Sample Output 2 2  X itself can be a prime number.       Sample Input 3 99992      Sample Output 3 100003

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

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

Solution (Python):
import math
def generate_primes(num):
    primes = list(range(2, num + 1))
    i, p = 0, 1
    while p <= math.sqrt(num):
        if primes[i] != 0:
            p = primes[i]
            primes = [prime if prime % p != 0 else 0 for prime in primes]
            primes[i] = p
        i += 1
    return [p for p in primes if p != 0]
x = int(input())
for i, p in enumerate(generate_primes(100003)):
    if p >= x:
        print(p)
        break

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

for num in range(x,10**6):
    ok = True
    for i in range(2,num):
        if num % i == 0:
            ok = False
    if ok:
        print(num)
        break

Solution (Python):
from bisect import bisect_left
def sieve_of_eratosthenes(N):
    numbers = [n & 1 for n in range(N + 1)]
    numbers[1] = 0
    primes = [2]
    p = 1
    while True:
        while not numbers[p]:
            p += 2
        if p * p > N:
            for i in range(p, N + 1, 2):
                if numbers[i]:
                    primes.append(i)
            return primes
        primes.append(p)
        for i in range(p, N + 1, p):
            numbers[i] = 0
primes = sieve_of_eratosthenes(10 ** 5 + 3)
print(primes[bisect_left(primes, int(input()))])

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

Solution (Python):
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    x = int(input())

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


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Solution (Python):

def solve():
    i = X
    while not prime(i):
        i += 1

    print(i)

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


if __name__=="__main__":
    X = int(input())

    solve()

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


def Prime(x):
    if x == 2:
        return 2
    if x % 2 == 0:
        return False
    else:
        sqrtx = x**(1/2)
        for i in range(3,int(sqrtx+1),2):
            if x % i == 0:
                return False
        return True

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

Solution (Python):
from math import sqrt
n=int(input())
def is_prime(n):
  if n<2:
    return False
  for k in range(2,int(sqrt(n))+1):
    if n%k==0:
      return False
  return True
while not is_prime(n):
  n+=1
print(n)

Solution (Python):
import math
x=int(input())
def prime(n):
    for i in range(2,int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True
for i in range(x,2**64):
    if prime(i)==True:
        print(i)
        break

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

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

import math

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

for k in range(n,200000):
  if is_prime(k)==True:
    print(k)
    break

Solution (Python):

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



X = int(input())

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

print(X)

Solution (Python):
import sys
a=int(input())
i=a
if a==2:
  print(2)
  sys.exit()
while True:
  b=int(i**0.5)
  judge=False
  for j in range(2,b+2):
    if i%j==0:
      i+=1
      judge=True
      break
    else:
      continue
  if judge==False:
    print(i)
    sys.exit()

Solution (Python):
import math


def main():
    import sys
    input = sys.stdin.readline
    from fractions import gcd

    X = int(input())

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


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


if __name__ == "__main__":
    main()

Solution (Python):
X=int(input())
ans=[0]*(2*X)
for x in range(X,2*X):
    cnt=0
    for i in range(2,x):
        if (x%i==0):
            cnt+=1
    if cnt==0:
        ans[x]=x
        break
print(max(ans))

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

def main():
    X = int(input())
    while True:
        tmp = make_divisors(X)
        if len(tmp) == 2:
            break
        X += 1

    print(X)


if __name__ == "__main__":
    main()

Solution (Python):
import math 
X  = int(input())
lis = [1]*(10**6+1)
lim = int(10**3)+1
for i in range(2,lim):
    if lis[i] == 1:
        for j in range(2,10**6+1):
            if i*j > 10**6:
                break
            else:
                lis[i*j] = 0

for i in range(X,len(lis)):
    if lis[i] == 1:
        print(i)
        break

Solution (Python):
x=int(input())
def hantei(n):
    for i in range(2,n):
        if n%i==0:
            return 0
    return 1

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

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

Solution (Python):

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

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

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

ans = 0

def prime(x):
    y = x//2+1
    cnt = 0
    for i in range(2,y+1):
        if x%i==0:
            cnt += 1
            
    if x==2:
        return 2
    else:
        if cnt==0:
            return x
        else:
            return 0
            
while ans == 0:
    ans = prime(x)
    x += 1
    

print(ans)

Solution (Python):
def prime_check(a):
    checker = 2
    while checker * checker <= a:
        if a%checker == 0:
            return False
        checker +=1
    return True

X = int(input())

count = X
while not prime_check(count):
    count +=1
    
print(count)

Solution (Python):
x=int(input())
temp=2
while temp<x:
    if x%temp==0:
        x+=1
        temp=2
    else:
        temp+=1
print(x)

Solution (Python):
import math

x = int(input())
for t in range(x, 2*(10**5)):
    res = False
    for k in range(2, int(math.sqrt(t)) + 2):
        if t % k == 0:res = True
    if t == 2:res = False
    if(res):continue
    print(t)
    break

Solution (Python):
import sys

x = int(input())

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

Solution (Python):
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import itertools
import math
x = ni()
def is_primes(n):
    primes = [1]*n
    primes[0] =0
    primes[1] =0
    for i in range(2,int(n**0.5)+1):
        if primes[i] ==1:
            for j in range(2*i,n,i):
                primes[j] = 0
    return primes
p = is_primes(10**7)
for i in range(10**7):
    if p[i] and i>=x:
        print(i)
        exit()

Solution (Python):
import bisect

n = 10**5+10
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)

x = int(input())
idx = bisect.bisect_left(primes, x)
print(primes[idx])

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

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

isPrime = makePrimeChecker(10**6)

while not isPrime[X]:
    X += 1

print(X)

Solution (Python):
import math
x=int(input())
yn=0
count=x-1
for i in range(x,x+100):
    count+=1
    yn=0
    for j in range(2,int(math.sqrt(count))+1):
        if count%j==0:
            yn=1
            break
        else:
            continue
    if yn==0:
        ans=count
        break
print(ans)

Solution (Python):
import math
import sys
sys.setrecursionlimit(100000)

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

def findPrime(x):
  if is_prime(x):
    return x
  else:
    return findPrime(x+1)

print(findPrime(X))

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

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

Solution (Python):
"""
素数判定

エラトステネスの篩：
x^(1/2)以下の素数が既知のとき、x^(1/2)以上x以下の素数を決定するには、x以下の整数でx^(1/2)以下の素数の倍数を全て取り除けば（=篩えば）よい
"""
x = int(input())

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

Solution (Python):
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect
import itertools
import heapq


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(input):
    MAX = 110000
    X = int(input)
    eratosthenes = set(range(2, MAX+1))
    primes = []

    top = min(eratosthenes)
    while top <= math.sqrt(MAX):
        eratosthenes.remove(top)
        primes.append(top)

        multiple = top + top
        while multiple <= MAX:
            if multiple in eratosthenes:
                eratosthenes.remove(multiple)
            multiple += top
        top = min(eratosthenes)

    primes.extend(list(eratosthenes))
    primes.sort()

    for p in primes:
        if p >= X:
            return p


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(input())
    print(ret)

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

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

Solution (Python):
import sys
import math

input = sys.stdin.readline

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

def main():
    ans = 0
    x = int(input())
    while check(x) == False:
        x += 1
    print(x)

if __name__ == '__main__':
    main()

Solution (Python):
x=int(input())
i=1
s=set([])
while(i<int(x**0.5)):
    i+=1
    mkr=0
    for j in s:
        if i%j==0:
            mkr=1
            break
    if mkr==0:
        s|={i}
i=x-1
while(1):
    i+=1
    mkr=0
    for j in s:
        if i%j==0:
            mkr=1
            break
    if mkr==0:
        print(i)
        break

Solution (Python):
from math import *

def isprime(n):
  if n<10: return n in (2,3,5,7)
  for i in range(2,int(sqrt(n)+1)):
    if n%i==0:
      return False
  return True

x = int(input())
for d in range(x, x+300):
  if isprime(d):
    print(d)
    break

Solution (Python):
from math import *

def isprime(n):
	if n<10:
		return n in (2,3,5,7)
	for i in range(2,int(sqrt(n)+1)):
		if n%i==0:
			return False
	return True
 
x = int(input())
for d in range(x,x+300):
	if isprime(d):
		print(d)
		break

Solution (Python):
def factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a
x = int(input())
for i in range(x,x+10000):
    if len(factorize(i)) == 1:
        print(i)
        break

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


while True:
    if is_prime(x):
        print(x)
        exit()
    else:
        if x % 2 ==0:
            x += 1
        else:
            x += 2

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

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

Solution (Python):
x = int(input())
ans = 0
while ans == 0:
    count = 2
    flg = 0
    while x >= count and flg == 0:
        if x % count == 0:
            flg = 1
            if x == count:
                ans = x
        else:
            count += 1
    x += 1
print(ans)

Solution (Python):
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 True:
  if is_prime(X):
    print(X)
    exit()
    
  X=X+1

Solution (Python):
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 n
for i in range(x,x+10000):
    tmp=is_prime(i)
    if tmp:
        print(tmp)
        exit()

Solution (Python):
X=int(input())
def sosuhantei(n):
    for i in range(2,n):
        if n%i==0:
            return 0
    return 1

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

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

Solution (Python):
import math
import random

def fermat(k):
    if k % 2 == 0 and k != 2:
      return False
            
    if pow(2, k-1, k) == 1:
      return True
    else:
      return False
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    
def using_sqrt(k):  
    factor = 0
        
    
    if k % 2 == 0 and k != 2:
        return False
        
    
    for divisor in range(2, math.floor(math.sqrt(k))+1):
        if k % divisor == 0:
            factor += 1
                
    if factor == 0:
        return True
    else:
        return False
            
 
  
n=int(input())
while True:
  if fermat(n):
    if using_sqrt(n):
      print(n)
      break
  if is_prime(n):
    if using_sqrt(n):
      print(n)
      break    
  n+=1

Solution (Python):

"""
Created on Sat May  9 14:38:46 2020

@author: shinba
"""

x = int(input())

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

print(x)

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

def sosu(x):
    
    if x==2:
        return True
    
    else:
        for i in range(2,x-1):
            if x%i==0:
                return False
        
        return True
        
        
for j in range(x,10**6):
    if sosu(j):
        print(j)
        break

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

def isSosu(n) :
    dest = int(math.sqrt(n))

    if n == 2 :
        return True

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

    return True


for j in range(X, 10**6) :
    if isSosu(j) :
        print(j)
        break

Solution (Python):
import math
X=int(input())
if X==2:
  print('2')
  exit()
else:
  l=list()
  x=math.sqrt(X)
  key=math.floor(x)
  for i in range(X,(key+1)**2):
    l.append(i)
    
for n in range(2,key+1):
  for x in l:
    if x%n==0:
      l.remove(x)
print(l[0])

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

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

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

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


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

Solution (Python):

import math


def 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


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

Solution (Python):
x = int(input())
ans = x
flg = False
while not flg:
    li = []
    for i in range(1,(ans)//2+1):
        if ans % i == 0:
            li.append(1)
        else:
            li.append(0)
    if sum(li) == 1:
        flg = True
    else:
        flg = False
        ans += 1
print(ans)

Solution (Python):
n=int(input())
t=n
g=0
while g==0:
  b=0
  for i in range(n):
    if i!=0 and i!=1:
      a=t%i
      if a==0:
        b=1
  if b==0:
    print(t)
    exit()
  else:
    t+=1

Solution (Python):
import sys
x=int(input())
if x==2 or x==3:
    print(x)
    sys.exit()
while 1:
    i=2
    c=False
    while i*i<=x:
        if x%i==0:
            c=True
            break
        i+=1
    if c:
        x+=1
        continue
    else:
        print(x)
        break

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


def is_prime(n):
    n_sqrt = n ** 0.5
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for num in range(3, int(n_sqrt), 2):
        if n == num:
            return True
        if n % num == 0:
            
            return False
    return True


while not is_prime(x):
    x += 1

print(x)

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

list = primelist(x*2)
print(min([i for i in list if i>=x]))

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

Solution (Python):
import math
def is_prime(n):
  if n == 1:
    return False
  for p in range(2, int(math.sqrt(n))+1):
    if n%p == 0:
      return False
  return True
m = int(input())
while m > 0:
  if is_prime(m) == True:
    print(m)
    break
  m += 1

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

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

for i in range(X,(X*2)+100,):
    if is_prime(i):
        print(i)
        break

Solution (Python):
X = int(input())
import math 
def get_prime(n):
    
    if n <=1:
        return []
    prime = [2]
    limit = int(math.sqrt(n))
    
    
    data = [i+1 for i in range(2,n,2)]
    while limit > data[0]:
        prime.append(data[0])
        data = [j for j in data if j % data[0] !=0]
    return prime + data
for x in get_prime(2*X):
    if x >=X:
        print(x)
        break

Solution (Python):
import math
def is_sosu(n):
  for i in range(2, math.floor(math.sqrt(n))+1):
    if n % i == 0:
      return False
  return True

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

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

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

ans = x
if ans%2 == 0:
    ans += 1
while True:
    i = 3
    while i < x:
        if ans%i == 0:
            break
        i += 2
    else:
        print(ans)
        exit()
    ans += 2

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

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

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

def get_prime(n):
  if n <= 1: return []
  limit = int(n**0.5)
  prime = [2]
  data = [i+1 for i in range(2,n,2)]
  while limit >= data[0]:
    prime.append(data[0])
    data = [j for j in data if j % data[0] != 0]
  return prime + data

l = get_prime(10**5+3)
i = bisect.bisect_right(l, x)
if l[i-1] == x: print(x)
else: print(l[i])

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


X = int(input())
num = X

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

Solution (Python):
'''
参考
https://qiita.com/srtk86/items/874639e361917e5016d4

整数Nが素数である=√N以下のすべての数で割り切れない
'''
import math

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

X = int(input())

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

print(X)

Solution (Python):
X = int(input())
def is_prime(num):
    if(num<=1):
        return False
    for i in range(2,num):
        if(num%i==0):
            return False
    return True

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

Solution (Python):
import sys
input=sys.stdin.readline
import math
x=int(input())
i=x
while True:
  flag="ok"
  for j in range(2,i):
    if i % j == 0:
      flag="ng"
      break
  if flag=="ok":
    print(i)
    break
  i+=1

Solution (Python):
import sys
input=sys.stdin.readline
import math
x=int(input())
i=x
while True:
  flag="ok"
  for j in range(2,int(math.sqrt(i)) + 1):
    if i % j == 0:
      flag="ng"
      break
  if flag=="ok":
    print(i)
    break
  i+=1

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

ceil_num = math.ceil(math.sqrt(x))


def is_prime(n):
    if n <= 1:
        return False
    else:
        pass
    for i in range(2, ceil_num):
        if n % i == 0:
            return False
    else:
        return True

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

Solution (Python):
def resolve():

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


resolve()

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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce


import sys
def I(): return int(input())  
def Is(): return map(int, input().split())  
def LI(): return list(map(int, input().split()))  
def TI(): return tuple(map(int, input().split()))  
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  
def LS(): return list(input())  
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

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

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

print(x)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

X = int(input())

import numpy as np

def make_prime(U):
    """素数判定（エラトステネスの篩）"""
    is_prime = np.zeros(U, np.bool)
    is_prime[2] = 1
    is_prime[3::2] = 1  
    M = int(U**.5) + 1
    for p in range(3, M, 2):  
        if is_prime[p]:
            is_prime[p*p::p+p] = 0  
    return is_prime, is_prime.nonzero()[0]

LIM = 10 ** 7
is_prime, primes = make_prime(LIM)
ans = list(filter(lambda x: x >= X, primes))[0]
print(ans)

Solution (Python):
import math
X=int(input())
ans = X
def 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 prime(ans):
        break
    ans += 1
print(ans)

Solution (Python):
import math

X = int(input())

cnt = 0


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

for j in range(1000000000):
  if prime(X) == True:
    print(X)
    break
  else:
    X += 1

Solution (Python):

x = int(input())
while True:

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

Solution (Python):


X = int(input())

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

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

print(X)

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

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

Solution (Python):
x=int(input())
keep=0
haha=0
while keep==0:
  check=0
  attack=x+haha
  for i in range(2,x):
    if attack%i==0:
      check=1
      break
  if check==0:
    keep=1
  haha+=1
print(attack)

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):
import numpy as np

n = 1000003
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 = np.array(list(primes))

x = int(input())

print(primes[np.where(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


x = int(input())

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

while 1:
    if is_prime(x):
        print(x)
        exit()
    else:
        x += 2

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


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


while not is_prime(X):
    X += 1

print(X)

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

for i in range(x,1000001):
    ok = True
    for j in range(2,x):
        if i%j == 0:
            ok = False
            continue
    if ok:
        print(i)
        break

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

Solution (Python):
def primenum(n):
  if n==2:
    return True
  elif n<2 or n%2==0:
    return False
  else:
    for i in range(3,int(n**0.5)+1,2):
      if n%i==0:
        return False
    return True

x = int(input())
for i in range(x,x**2):
  if primenum(i):
    print(i)
    break

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

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

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


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

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

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

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

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

Solution (Python):

def isPrime(x):
    if x < 2:
        return 0
    elif x == 2:
        return 1
    if x%2 == 0:
        return 0
    ir=int(x**(0.5))+1
    for i  in range(3,ir,2) :
        if x%i == 0:
            return 0
    return 1

x=int(input())

for i in range(x,10**5+4,1):
    if isPrime(i):
        print(i)
        break

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

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

    if flag:
        print(x)
        break

    x += 1

Solution (Python):

def main():
    n = int(input())
    flg = False

    while not flg:
        if is_prime(n):
            print(n)
            exit()
        else:
            n += 1

def is_prime(num):
    if num == 2:
        return True
    if num % 2 == 0:
        return False
    for i in range(3, num // 2 + 1, 2):
        if num % i == 0:
            return False

    return True

if __name__ == '__main__':
    main()