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):
import math
X =int(input())
Sqx = int(math.sqrt(X))
A=0
while A==0:
    for i in range(0,1000):
        if A != 0:
            break
        P = X
        P += i
        for j in range(2,Sqx+10):
            if P % j == 0:
                if P == j:
                    A = P
                    break
                else:
                    break
            elif j == Sqx:
                A = P
                break
print(A)

Solution (Python):
import math
x = int(input())
for k in range(x, 2 * x):
    factor = 0
    if k % 2 == 0 and k != 2:
        continue
    for divisor in range(2, math.floor(math.sqrt(k)) + 1):
        if k % divisor == 0:
            factor += 1
    if factor == 0:
        print(k)
        break

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

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


def main():
    X = int(input())
    while True:
        if is_prime(X):
            print(X)
            break
        X += 1


if __name__ == '__main__':
    main()

Solution (Python):
def get_primes(x):
    if x < 2:
        return list()
    primes = [2]
    n = 3
    while n <= x:
        is_prime = True
        for p in primes:
            if n % p == 0:
                is_prime = False
                break
            if p**2 > n:
                break
        if is_prime:
            primes.append(n)
        n += 2
    return primes


def main():
    X = int(input())
    if X <= 1:
        print(2)
        exit(0)
    primes = get_primes(X)
    while True:
        is_prime = True
        for p in primes:
            if X % p == 0 and X > p:
                is_prime = False
                break
        if is_prime:
            break
        X += 1
    print(X)


if __name__ == '__main__':
    main()

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

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

Solution (Python):

import sys
import itertools
import fractions
import copy
import bisect
import numpy as np


from operator import itemgetter
from sys import stdin

from operator import mul
from functools import reduce
from collections import Counter




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

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

N=3
M=3
i=0
j=0
k=0
n=3
r=1
a=[0]*5
b=[]
X=int(input())
for i in range(5000):
    if is_prime(X+i):
        print(X+i)
        sys.exit()








"1行1つの整数を入力を取得し、整数と取得する"




"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

for i in number_list:
    print(number_list[i-1])

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''



"正方行列にstr型の値を入力"
'''




'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''











'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''




"aという変数に入っているものを大文字にして出力"















'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''


'''
def cmb(n,r):
    
    r= min(n-r,r)
    
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    
    
    

    under = reduce(mul, range(1, r+1))
    
    
    
    

    return over // under
    
    
    
    
a = cmb(n, r)

'''

'''




for i in a.most_common(n):print(i)





 


'''









'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''

Solution (Python):
import math as m

X = int(input())

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline

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

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

    while True:
        if is_prime(N):
            print(N)
            return
        N += 1



if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
from math import sqrt

x = int(input())
ans = 0

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

for num in range(x, 10**6):
    if is_prime(num):
        ans = num
        break

print(ans)

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

n = int(input())

i = n
while(not is_prime(i)):i += 1
print(i)

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

Solution (Python):
if __name__ == "__main__":
    frui = [True] * (10 ** 5 + 4)

    for i in range(2, 10 ** 5 + 4):
        tmp = i
        if frui[tmp]:
            for j in range(2*tmp, 10 ** 5 + 4, tmp):
                frui[j] = False
    
    x = int(input())


    ans = 0
    for i in range(x, 10 ** 5 + 4):
        if frui[i]:
            ans = i
            break
    print(ans)

Solution (Python):
import math
X = int(input())
def isprime(n):
    max_n = math.floor(math.sqrt(n))
    for i in range(2, max_n+1):
        if n % i != 0:
            continue
        else:
            return False
    else:
        return True
while(not(isprime(X))):
    X = X+1
print(X)

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

for i in range(X):
    count=0
    for j in range(X+i-2):
        if (X+i)%(j+2)==0:
            count+=1
    if count==0:
        print(X+i)
        exit(0)

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

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

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

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

Solution (Python):
import math

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

def solve():
    X = int(input())
    while 1:
        if isPrime(X):
            return X
        X += 1

print(solve())

Solution (Python):
import math
ans=int(input().strip('\n'))
if ans!=2:
    flag=True
    while flag:
        for i in range(2,math.ceil(math.sqrt(ans))+1):
            if ans%i==0:
                flag=False
                break
        if flag:
            break
        else:
            flag=True
            ans+=1
print(ans)

Solution (Python):
def myFunc(N):
  sosu = True
  for i in range(2,N):
    sosu = sosu and N%i!=0
  return sosu

i = int(input())
while True:
  if myFunc(i): break
  i = i + 1

print(i)

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, n + 1):
        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]]

l = primes(100000)
l.append(100003)
print(l[bisect_left(l, int(input()))])

Solution (Python):

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


def main():
    X = int(input())
    for x in range(X, 2*X):
        if is_prime(x):
            print(x)
            break


if __name__ == "__main__":
    main()

Solution (Python):

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


def main():
    X = int(input())
    primes = get_sieve_of_eratosthenes(X*2)
    for p in primes:
        if X <= p:
            print(p)
            break


if __name__ == "__main__":
    main()

Solution (Python):
import random


def main():
    X = int(input())
    for i in range(X, 10 ** 6):
        if is_prime(i) == True:
            print(i)
            break


def is_prime(n):
    if n == 1:
        return False
    if n == 2:
        return True
    if n == 561:
        return False
    if n == 1729:
        return False
    for _ in range(100):
        a = random.randint(2, n - 1)
        if gcd(n, a) != 1:
            return False
        if pow(a, n - 1, n) != 1:
            return False
    return True


def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a


if __name__ == "__main__":
    main()

Solution (Python):
import math
X = int(input())
while any(X % i == 0 for i in range(2, int(math.sqrt(X)+1))):
  X += 1
print(X)

Solution (Python):
import math
X = int(input())
X -= 1
Flag = True

if X == 1:
  print(2)
  Flag = False

while Flag:
  X += 1
  r = 1
  for i in range(math.ceil(math.sqrt(X)) - 1):
    r += 1
    if X % r == 0:
      break
    if r == math.ceil(math.sqrt(X)):
      print(X)
      Flag = False

Solution (Python):
import math

def aa(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
      
x = int(input())

while aa(x)== False:
    x +=1
    
print(x)

Solution (Python):
N = int(input())
import math
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
def prime(q):
    a = int(math.sqrt(q))
    for i in range(2,a+1):
        if q % i == 0:
            return False
    return True
while True:
    if prime(N):
        print(N)
        exit()
    N += 1

Solution (Python):
import math
n = int(input())
while 1 > 0:
    if n == 2 or n ==3:
        break
    k = 0
    l = 0
    r = int(math.sqrt(n) // 1)
    for i in range(2, r + 1):
        if n % i == 0:
            k = 1
        if i == r:
            if k == 0:
                l = 1
    if l == 1:
        break
    else:
        n += 1

print(n)

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

X=int(input())

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

Solution (Python):
X = int(input())
done = False
num = X - 1

while not done:
    num += 1
    if num > 1:
        for i in range(2, num):
            if (num % i) == 0:
                break
        else:
            done = True

print(num)

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


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


isPrime = isP(x)

if isPrime:
    print(x)
else:
    while isPrime == False:
        x += 1
        isPrime = isP(x)
    print(x)

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())
while is_prime(x) == False:
    x += 1
print(x)

Solution (Python):
import math
n = int(input())
for i in range(n, 2**n):
  cnt = 0
  for j in range(2, n):
    if i%j==0:
      cnt += 1
  if cnt ==0:
    print(i)
    break;

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

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

sosu=[]

i=2
import math

while 1:
    sqrt_i =int(math.sqrt(i))

    flag=0
    for item in sosu:
        if item>sqrt_i:
            break
        if i%item==0:
            flag=1
            break

    if flag==0:
        sosu.append(i)
        if i>=x:
            print(i)
            exit()
    i+=1

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

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

print(p)

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

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

n = 2 * X
is_prime = [False] * 2 + [True] * (n - 1)

for i in range(2, int(n ** 0.5) + 1): 
    if not is_prime[i]: continue
    for j in range(2 * i, n + 1, i):
        is_prime[j] = False

for i in range(X, n):
    if is_prime[i]:
        print(i)
        break

Solution (Python):
x = int(input())
def han(n):
    p = 1
    for i in range(2,int(n**0.5)+1):
        if n%i == 0:
            p = p*0
        else:
            continue
    return p
for j in range(x,x+10000):
    if han(j) == 1:
        print(j)
        break

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

n=int(input())

i=0
while True:
    if prime(n+i):
        print(n+i)
        exit()
    else:
        i+=1

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

n=int(input())

i=0
while True:
    if prime(n+i):
        print(n+i)
        exit()
    else:
        i+=1

Solution (Python):

import numpy as np
from collections import deque
x = int(input())


prim_numbers = [2]
for divided in range(3, x, 2):
    for prim in prim_numbers:
        if divided % prim == 0:
            continue
        else:
            prim_numbers.append(divided)
            break


def is_prim(q):
    for divider in prim_numbers:
        if q % divider == 0:
            return False
    return True



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

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

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


while True:

    flg = 0
    for i in range(1,X+1):
        if X%i==0:
            if i!=1 and  i!=X:
                flg=1
    
    if flg == 0:
        break

    X+=1

print(X)

Solution (Python):
X = int(input())
isPrime = [True] * (X * 2)
isPrime[0] = False
isPrime[1] = False

for i in range(2,X):
  for j in range(i,X*2,i):
    isPrime[j] = False
  
ans = None
for i in range(X,X*2):
  if isPrime[i]:
    ans = i
    break
    
print(ans)

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

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

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

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

for i in range(x,10**5+4):
    if ans != 0:
        break
    
    for j in range(2,i):
        if i % j == 0:
            break
        elif j == i-1:
            ans = i

if x == 2:
    ans = 2

print(ans)

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

for i in range(n,10**6):
  count = 0
  for j in range(2, int(math.sqrt(i))):
    if(i % j == 0 and i != j):
      count = 1
      break
  if(count == 0):
    print(i)
    break

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

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

Solution (Python):


import math

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

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

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

p = [2]
i = 1
Flag = True
while i**2 < 100001:
    i += 2
    for j in p:
        if i%j == 0:
            break
        elif j == p[-1]:
            p.append(i)
for i in range(100000):
    if x+i in p:
        ans = x+i
        break
    elif x+i > p[-1]:
        for j in p:
            if (x+i)%j == 0:
                break
            elif j == p[-1]:
                ans = x+i
                break
        if ans == x+i:
            break

print(ans)

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

def get_prime(n):
    if n <= 1:
        return []
    prime = [2]
    limit = 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

plist = get_prime(200000)
ans = 0
for y in range(x, 200000):
    if y in plist:
        ans = y
        break
    else:
        pass

print(ans)

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

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

print(m)

Solution (Python):
def is_prime(x):
    for i in range(2, x):
        if x%i == 0:
            return 1
    return 0

x = int(input())

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

Solution (Python):
import numpy as np
X = int(input())
A = np.array(range(X,X+100))
if X==2:
    print(X)
    exit()

A = np.array(range(3,10**5+4,2))
for i in range(3,int(np.sqrt(10**5+4))+1000,2):
    A = np.where((A%i == 0) & (A//i != 1), 1, A)

A = np.sort(A)
I = np.searchsorted(A,X, side="left")
print(A[I])

Solution (Python):
import math

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

x = int(input())

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x=int(input())
    ans=x
    while True:
        flag=False
        for i in range(2,int(x**0.5)):
            if ans%i==0:
                flag=True
                break
        if flag:
            ans+=1
            continue
        else:
            break
    print(ans)
resolve()

Solution (Python):
sieve = [True] * (10**6 + 1)
for i in range(2, 10**3):
  if sieve[i]:
    for j in range(i**2, 10**6, i):
      sieve[j] = False
sieve[0] = sieve[1] = False
x = int(input())
ind = x
while True:
  if sieve[ind]:
    print(ind)
    break
  ind += 1

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

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

Solution (Python):
x = int(input())
num = 0
j = 1
while(j):
    ans = 1
    for i in range(2,1000):
        if (x+num)%i == 0 and x+num > i :
            ans = 0
            break
        elif x + num <= i:
            break
        else:
            pass
    if ans == 1:
        j = 0
    num +=1

print(x+num-1)

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

if x == 2:
    print(2)
    exit()
 
while True:
    f = True
    g = math.ceil(math.sqrt(x))
    for i in range(2,g+1):
        if x%i == 0:
            f = False
            break
    if f == True:
        print(x)
        exit()
    x += 1

Solution (Python):
import math

x = int(input())

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

while True:
    f = True
    g = math.ceil(math.sqrt(x))
    for i in range(2,g+1):
        if x%i == 0:
            f = False
            break
    if f == True:
        print(x)
        exit()
    x += 1

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

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

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

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

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

for i in range(1000):
    A=is_prime(X+i)
    if A==True:
        print(X+i)
        break

Solution (Python):


X = int(input())


for i in range(X, 10**100):
    if all(i%j != 0 for j in range(2, int(i**(1/2)+1))):
        print(i)
        exit()

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

X = int(input())

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

print(X)

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

for i in range(x,10**6):
    for k in range(2,i):
        if i % k != 0:
            continue
        else:
            break
    else:
        break
print(i)

Solution (Python):
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

N = 200000   
prime = [True]*(N+1)
prime[0] = False
prime[1] = False

R = int(math.sqrt(N))

for i in range(2, R+1):
    if prime[i]:
        cnt = 2
        while i * cnt <= N:
            prime[i * cnt] = False
            cnt += 1

X = int(input())
while True:
    if prime[X]:
        break
    else:
        X += 1
print(X)

Solution (Python):
import math

x = int(input())

for num in range(x, 100003+1):
    cnt = 0
    
    for i in range(2, int(math.sqrt(num))+1):
        if num % i == 0:
            cnt += 1
    if cnt == 0:
        print(num)
        break

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

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

while non_prm(X):
    X += 1

print(X)

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

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):
def prime(X):
    if X<2:
        return False
    if X==2:
        True
    for i in range(2,X):
        if X%i==0:
            return False
    return True
X=int(input())
p=False
while p==False:
    p=prime(X)
    X+=1
print(X-1)

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



if __name__ == '__main__':
    solve()

Solution (Python):
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

X = ri()

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

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

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

def prime(N):
  for i in range(2,N-1):
    if N%i==0:
      return -1
  
  return N

for x in range(X,10**10):
  if prime(x)==x:
    print(x)
    break

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

while(1):
    check = 0
    for i in range(1,count+1):

        if count % i == 0:
            check += 1
    if check == 2:
        break
    count += 1
print(count)

Solution (Python):
import math
n = int(input())
div = math.floor(math.sqrt(n))
def sosu(n):
    if n <= 1:
        return False
    for i in range(2,div+1):
        if n%i==0:
            return False
    return True
while True:
    if sosu(n):
        print(n)
        break
    else:
        n+=1

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

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

arr =primes(10**5+100)

for i in range(X,10**5+100,1):
    if arr[i]:
        print(i)
        exit()

Solution (Python):
from math import sqrt
def judge(num):
    if num < 2:
        return False
    elif num == 2:
        return True
    elif num % 2 == 0:
        return False
    else:
        for i in range(3,int(sqrt(num))+1,2):
            if num % i == 0:
                return False
        return True
s = int(input()) 
while(1):
    if judge(s):
        print(s)
        break
    else:
        s += 1

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

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

prime_list = primes(100100)

for i in prime_list:
    if X <= i:
        print(i)
        exit()

Solution (Python):
import math

X = int(input())

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

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

Solution (Python):
def abc149_c():

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

  
  all_primes = primes_list(10**5)
  all_primes.append(100003)
  all_primes.sort()

  
  x = int(input())
  for p in all_primes:
    if x <= p:
      print(p)
      return

abc149_c()

Solution (Python):
N = int(input())
n = 11**5
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)
print(min([i for i in primes if i >= N]))

Solution (Python):

x=int(input())
j=0

while j==0:
    ans=0
    if x%2==0 and x!=2:
        x+=1
        continue
    for i in range(2,x//2):
        if x%i==0:
            ans+=1
    if ans==0:
        j=x

    x+=1

print(j)

Solution (Python):
import math

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

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

    return True

X = int(input())

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

Solution (Python):

X = int(input())

flg = 1
ans = 0
for i in range(X, 10**100):
    flg = 1
    for j in range(2, i):
        if i % j == 0:
            flg = 0
            break
    if flg == 1:
        ans = i
        break

print(ans)

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

if x == 2:
    print(2)
    quit()
li = [2]
for i in range(3, 10 ** 6, 2):
    for j in li:
        if i % j == 0:
            break
    else:
        if i >= x:
            print(i)
            quit()
        li.append(i)

Solution (Python):
import math

N = int(input())

for j in range (N, 1000000):
    t = 0
    dest = int(math.sqrt(j))

    for i in range(2,dest+1):
        if j % i == 0:
            t = 1
            break

    if t == 0:
        print(j)
        break

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


def calculate(x):
    if x == 2:
        return 2

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

    return x

def condition(x):
    result = True
    for i in range(2,x):
        if x % i == 0:
            result = False
            break

    return result


result = calculate(X)

print(result)

Solution (Python):
from math import *
x = int(input())
if x == 2 or x == 3:
    print(x)
else:
    while True:
        done = True
        if x % 6 != 1 and x % 6 != 5:
            done = False
        else:
            upper = floor(sqrt(x))
            for i in range(2, upper+1):
                if x % i == 0:
                    done = False
                    break
        if done:
            print(x)
            break
        x += 1