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())
def is_prime(X):
  i = 2
  while i <= math.sqrt(X):
    if X % i == 0:
      return False
    i += 1
  return True
while not is_prime(X):
  X += 1
print(X)

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

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

Solution (Python):
import math

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

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

    return True
    
def main():
    X = int(input())
    
    flag = True
    while flag:
        if is_prime(X):
            flag = False
        else:
            X += 1
    print(X)


if __name__ == "__main__":
    main()

Solution (Python):
import math

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

X = int(input())
flg = False

while flg!=True:
    flg = isprime(X)
    X = X + 1
print(X-1)

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

if N%2==0 and not N==2:
    N=N+1

j = 0
while True:
    for i in range(2, N//2):
        if N%i==0:
            N += 2
            break
    else:
        break
print(N)

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

c = 0

import math
def is_prime(a):
    if a == 1: return False

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

    return True

while(c == 0):
    if is_prime(n):
        print(n)
        break
    else:
        n += 1

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

def ans(n):
    for i in range(2, N//2+1):
        if n%i==0:
            return ans(n+1)
    return n

print(ans(N))

Solution (Python):
import math
x = int(input())
plus = 1 if x % 2 == 0 else 2

class Prime:
    seed_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

    def is_prime(self, n):
        """
        prime test (hybrid)

        see also: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369

        :param n:
        :return: boolean
        """
        is_prime_common = self.is_prime_common(n)
        if is_prime_common is not None:
            return is_prime_common

        if n < 2000000:
            return self.is_prime_brute_force(n)
        else:
            return self.is_prime_miller_rabin(n)

    def is_prime_common(self, n):
        if n == 1: return False
        if n in Prime.seed_primes: return True
        if any(map(lambda x: n % x == 0, self.seed_primes)): return False

    def is_prime_brute_force(self, n):
        """
        brute force prime test
        use with is_prime_common if you want to skip seed_primes

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

    def is_prime_miller_rabin(self, n):
        """
        miller rabin prime test
        use with is_prime_common if you want to skip seed_primes

        see also
            algorithm: https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test
            implementation: https://qiita.com/srtk86/items/609737d50c9ef5f5dc59
            improvement: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369

        :param n:
        :return: boolean
        """

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

        
        witnesses = self.get_witnesses(n)
        

        for w in witnesses:
            y = pow(w, d, n)

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

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

        return True

    def get_witnesses(self, num):
        def _get_range(num):
            if num < 2047:
                return 1
            if num < 1373653:
                return 2
            if num < 25326001:
                return 3
            if num < 3215031751:
                return 4
            if num < 2152302898747:
                return 5
            if num < 3474749660383:
                return 6
            if num < 341550071728321:
                return 7
            if num < 3825123056546413051:
                return 9
            return 12

        return self.seed_primes[:_get_range(num)]

    def gcd(self, a, b):
        if a < b:
            return self.gcd(b, a)
        if b == 0:
            return a
        while b:
            a, b = b, a % b
        return a

    @staticmethod
    def f(x, n, seed):
        """
        pseudo prime generator
        :param x:
        :param n:
        :param seed:
        :return: pseudo prime
        """
        p = Prime.seed_primes[seed % len(Prime.seed_primes)]
        return (p * x + seed) % n

    def find_factor(self, n, seed=1):
        """
        find one of factor of n
        this function is based to Pollard's rho algorithm

        see also
            algorithm: https://en.wikipedia.org/wiki/Pollard%27s_rho_algorithm
            implementation: https://qiita.com/gushwell/items/561afde2e00bf3380c98

        :param n:
        :param seed:
        :return: factor
        """
        if self.is_prime(n):
            return n

        x, y, d = 2, 2, 1
        count = 0
        while d == 1:
            count += 1
            x = self.f(x, n, seed)
            y = self.f(self.f(y, n, seed), n, seed)
            d = self.gcd(abs(x - y), n)

        if d == n:
            return self.find_factor(n, seed + 1)
        return self.find_factor(d)

    def find_factors(self, n):
        primes = {}
        if self.is_prime(n):
            primes[n] = 1
            return primes

        while n > 1:
            factor = self.find_factor(n)

            primes.setdefault(factor, 0)
            primes[factor] += 1

            n //= factor

        return primes

prime = Prime()
if prime.is_prime(x):
    print(x)
else:
    x += plus
    plus = 2
    while True:
        if prime.is_prime(x):
            break
        x += plus
    print(x)

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

Solution (Python):
def main():
    n = int(input())
    print(find_next_prime(n))


def find_next_prime(n):
    return find_prime_in_range(n, 2*n)


def find_prime_in_range(a, b):
    for p in range(a, b):
        for i in range(2, p):
            if p % i == 0:
                break
        else:
            return p
    return None


if __name__ == '__main__':
    main()

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

Solution (Python):


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

X = int(input())

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

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

n=int(input())
is_prime=primes(10**6)
for i in range(n,10**6):
    if is_prime[i]:
        print(i)
        exit()

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

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

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

Solution (Python):
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))



X = I()

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

print(X)

Solution (Python):



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

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

Solution (Python):
n = int(input())
ma = 100003
prime = [True] * (ma + 1)
prime[0] = False
prime[1] = False
for i in range(2, int(ma ** 0.5) + 1):
    if not prime[i]:
        continue
    for j in range(i * 2, ma + 1, i):
        prime[j] = False
if prime[n]:
    print(n)
else:
    for i in range(n + 1, len(prime)):
        if prime[i]:
            print(i)
            break

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

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

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

def primes(n):
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

pn = primes(10**6)

def bsearch(v, l, r):
    if l >= r - 1:
        return [l, r]
    m = l + ((r - l) // 2)
    if pn[m] < v:
        return bsearch(v, m, r)
    else:
        return bsearch(v, l, m)

l, r = bsearch(X, 0, len(pn))

if X == 2:
    print(2)
else:
    print(pn[r])

Solution (Python):
import unittest
import math


class TestC(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think(20), 23)

    def test_2(self):
        self.assertEqual(think(2), 2)

    def test_3(self):
        self.assertEqual(think(99992), 100003)


def solve():
    x = read()
    result = think(x)
    write(result)


def read():
    return read_int(1)[0]


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(x):
    index = 0
    while True:
        buf = x + index
        if is_prime(buf):
            return buf
        index += 1


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

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


def write(result):
    print(result)


if __name__ == '__main__':
    
    solve()

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10000000)

from bisect import *





INF = 500000
MOD = 10**9+7

ps = []
is_p = [True] * 10**6
for i in range(2, 10**6):
    if is_p[i]:
        for j in range(i+i, 10**6, i):
            is_p[j] = False
        ps.append(i)

print(ps[bisect_left(ps, int(input()))])

Solution (Python):
def A():
    temp = input().split()
    print(''.join(temp[::-1]))

def B():
    temp = [int(n) for n in input().split()]
    A = temp[0]
    B = temp[1]
    K = temp[2]
    to_minus = min(A, K)
    A -= to_minus
    K -= to_minus
    if K > 0:
        B -= min(B, K)
    print (A, B)

import math
def C():
    X = int(input())
    if X <= 2:
        print(2)
        return

    def isPrime(n):
        if n <= 3:
            return True
        if(n % 2 == 0 or n % 3 == 0): 
            return False
      
        for i in range(5,int(math.sqrt(n) + 1), 6):  
            if(n%i == 0 or n%(i + 2) == 0): 
                return False
        
        return True
    
    while True:
        if isPrime(X):
            print(X)
            return
        X += 1

C()

Solution (Python):
from bisect import bisect_left
def prime(n):
    a = [0] * (n + 1)
    a[0] = 1
    a[1] = 1
    i = 2
    while n // i >= i:
        if a[i] != 0:
            i += 1
            continue
        j = 2 * i
        while j <= n:
            a[j] = 1
            j += i
        i += 1
    return [i for i, ai in enumerate(a) if ai == 0]


x = int(input())
primes = prime(10**6)
p = bisect_left(primes, x)
print(primes[p])

Solution (Python):

import math


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


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

Solution (Python):
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)
INF=10**9


[X]  = list(map(int,input().split()))


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


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

for i in range(X,INF):
    if is_prime(i):
        print(i)
        exit(0)
print(-1)

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

def 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 not(prime(n)):
    n += 1

    
print(n)

Solution (Python):
x=int(input())
n=10**5 +10**4
flag=0
pn=0
if x==2:
    print(2)
else:
    for i in range(x,n):
        flag=0
        for k in range(2, int((i)**(1/2))+5):
            if i%k==0:
                flag+=1
        if flag==0:
            pn=i
            break
    print(pn)

Solution (Python):
def pm_table(n):
    """
    素数テーブル
    n以下の素数のリストを返却する
    :param n:
    :return:素数のリスト
    """
    res = [1] * (n + 1)
    res[:2] = 0, 0

    for i in range(2, n):
        if i ** 2 > n:
            break

        if res[i] == 1:
            for j in range(i * 2, n + 1, i):
                res[j] = 0

    return [i for i, x in enumerate(res) if x == 1]


X = int(input())
tbl = pm_table(10 ** 6)
for p in tbl:
    if X <= p:
        print(p)
        exit()

Solution (Python):
def check_primal(num):
    '''素数だったら0を、違ったら1を返す'''
    for mod in range(2, int(num**0.5+1)):
        if num % mod == 0:
            return 1
    return 0


x = int(input())

for i in range(x, 100004):
    if check_primal(i) == 0:
        print(i)
        break

Solution (Python):
def isPrime(n):
  for i in range(n):
    if i == 0 or i == 1:
      continue
    if n % i == 0:
      return False
  return True

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

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

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

Solution (Python):
from subprocess import*
x=int(input())
while len(Popen(['factor',str(x)],stdout=PIPE).communicate()[0].split())>2:x+=1
print(x)

Solution (Python):
import bisect
sieve=[1]*1000001
i=2
while i*i<=1000001:
    if sieve[i]==1:
        for j in range(i*i,1000001,i):
            sieve[j]=0
    i+=1
lol=[]
for i in range(2,1000001):
    if sieve[i]:
        lol.append(i)
        
x=int(input())
y=bisect.bisect(lol,x)
if lol[y-1]==x:
    print(x)
else:    
    print(lol[y])

Solution (Python):

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

X = int(input())
while True:
    if elatostenes(X):
        print(X)
        exit()
    else:
        X += 1

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

Solution (Python):
import math


def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []
    time = 0

    while True:
        prime = min(A)

        if prime > math.sqrt(limit):
            break

        P.append(prime)

        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1

    for a in A:
        P.append(a)

    return P

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

  
  
  
  
  P = eratosthenes(10**5+489)

  i = 0
  while True:
      if P[i] >= X:
          break
      i += 1

  print(P[i])

if __name__ == '__main__':
    main()

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


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


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

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

Solution (Python):

X = int(input())
maxN = 10**5 + 1000
isPrime=[True]*(maxN+1)
isPrime[0],isPrime[1] = False,False

for i in range(2,maxN+1):
    if not(isPrime[i]):
        continue
    tmp = i*2
    while tmp<maxN:
        isPrime[tmp] = False
        tmp += i

ans = X
while not(isPrime[ans]):
    ans += 1
print(ans)

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

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):
x=int(input())
cont=0
for i in range(x,10**12):
    for j in range(2,i):
        if i%j==0:
            cont+=1
    if cont==0:
        print(i)
        exit()
    cont=0

Solution (Python):
import math
import bisect
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 = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
    return data

N=int(input())
L=get_sieve_of_eratosthenes(10**5+10)
print(L[bisect.bisect_left(L,N)])

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

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

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

print(x)

Solution (Python):
def c_next_prime():
    from bisect import bisect_left
    X = int(input())

    def prime_table(n):
        """n以下の素数のリスト(エラトステネスの篩)"""
        is_prime = [True] * (n + 1)
        is_prime[0] = is_prime[1] = False  
        for j in range(2, int(n**0.5) + 1):
            if not is_prime[j]:
                continue
            for k in range(j * 2, n + 1, j):
                is_prime[k] = False  
        return [i for i in range(n + 1) if is_prime[i]]

    primes = prime_table(min(2 * X, 10**5 + 3))
    return primes[bisect_left(primes, X)]

print(c_next_prime())

Solution (Python):



test = ""
test = \
"""

"""

test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()

        
n = int(input2())

def primes(n):
    ps = [2]
    for odd in range(3, n + 1, 2):
        for p in ps:
            if odd % p == 0:
                break
            if p ** 2 > odd:
                ps.append(odd)
                break
    return ps


def isprime(n):
    last = int(n**.5)
    for m in primes(last):
        if n % m == 0:
            return False
    return True


def nextprime(n):
    if n in primes(n):
        return n
    elif n == 1:
        return 2
    else:
        i = n
        while not isprime(i):
            i += 1
        return i


print(nextprime(n))

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

Solution (Python):
import math

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

def solve():
	x = int(input())
	number = x
	while isPrime(number) != True:
		number += 1
	print(number)

solve()

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

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

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

Solution (Python):



x = int(input())

def judge(p):
    j = True
    for i in range(2, int(p**0.5)):  
        if p%i == 0:
            j = False
            continue
    return(j)
   
c = False
while not c:
    c = judge(x) 
    x += 1
    
print(x - 1)

Solution (Python):
f=[True]*(10**5+10000)
f[0]=False
f[1]=False
for i in range(2,len(f)):
  if f[i]:
    for j in range(i*2,len(f),i):
      f[j]=False
for i in range(int(input()),len(f)):
  if f[i]:
    print(i)
    break

Solution (Python):


from collections import deque, defaultdict
import itertools as ite
import sys
import math
import decimal

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

X = input()

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

Solution (Python):
def primes(N):
    p = [False, False] + [True] * (N - 1)
    for i in range(2, int(N ** 0.5) + 1):
        if p[i]:
            for j in range(i * 2, N + 1, i):
                p[j] = False
    return p


N = int(input())
P = primes(N * 2)
print([i for i in range(N, N * 2) if P[i]][0])

Solution (Python):
def find_next_prime(x):
	while True:
		for i in range(x):
			if i+1 == 1: continue
			if x == (i+1): return x
			if x%(i+1) == 0: break
		x += 1

x = int(input())
print(find_next_prime(x))

Solution (Python):
def is_prime(n: int):
    """自然数nが素数であるかを判定する
    計算量: O(sqrt(N))
    """
    if n == 1:
        return False
    for k in range(2, int(n**0.5) + 1):
        if n % k == 0:
            return False
    return True


x = int(input())

while True:
    if is_prime(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


X = int(input())

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

print(ans)

Solution (Python):
def c_next_prime():
    from bisect import bisect_left
    X = int(input())

    def prime_table(n):
        """n以下の素数のリスト(エラトステネスの篩)"""
        is_prime = [True] * (n + 1)
        is_prime[0] = is_prime[1] = False  
        for j in range(2, int(n**0.5) + 1):
            if not is_prime[j]:
                continue
            for k in range(j * 2, n + 1, j):
                is_prime[k] = False  
        return [i for i in range(n + 1) if is_prime[i]]

    primes = prime_table(2 * X)
    return primes[bisect_left(primes, X)]

print(c_next_prime())

Solution (Python):
X = int(input())
P = [True] * 100100
for i in range(2, 100100):
    if not P[i]:
        continue
    for j in range(i*2, 100100, i):
        P[j] = False
for i in range(X, 100100):
    if P[i]:
        print(i)
        break

Solution (Python):
import math
x = int(input())
if x == 2:
    print(2)
    exit()
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

if x %2 == 0:
    target = (x+1)
else:
    target = x
for i in range(target, 1000000):
    if is_prime(i) is True:
        print(i)
        exit()
    else:
        continue

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


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

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


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
l = [1]*100010
l[0] = 0
l[1] = 0
for i in range(2,10**5+10):
  if l[i]:
    for j in range(2*i,10**5+10,i):
      l[j] = 0
while not l[n]:
  n += 1
print(n)

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

X = int(input())
done = False
while not done:
    a = make_divisors(X)
    if len(a) == 2:
        done = True
        c = X
    else:
        X += 1
       

print(c)

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

def is_prime_number(n):
    """
    >>> is_prime_number(1)
    False

    >>> is_prime_number(29)
    True

    >>> is_prime_number(30)
    False
    """
    import math
    if n == 1:
        return False

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

for i in range(X, 10**9):
    if is_prime_number(i):
        print(i)
        break

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

def check(X):
    for i in range(2,X//2):
        if X % i == 0:
            return True
    return False

while(check(ans)):
    ans += 1

print(ans)

Solution (Python):
import numpy as np
i8 = np.int64

maxnum = 110000
X = int(input())
a = np.zeros(maxnum, i8)

for i in range(2, 400):
    if a[i] == 0:
        j = i * 2
        while j < maxnum:
            a[j] = 1
            j += i
for i in range(X, maxnum):
    if a[i] == 0:
        print(i)
        exit(0)

Solution (Python):

def sosu(num):
    flag=True
    for i in range(2,num):
        if num%i==0:
            flag=False
    return flag
x=int(input())
ans=0
cnt=0
while True:
    ans=x+cnt
    if sosu(ans):
        print(ans)
        break
    cnt+=1

Solution (Python):
X = int(input())
result = []
for i in range(X,X*2):
    for j in range (2,i):
        if (i % j) == 0:
            break
    else:
            result.append(i)
            a = i
            break
print (a)

Solution (Python):
import math 
def is_prime(n):
    if n == 1: return False

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

    return True
  
  
x = int(input())

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

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

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

Solution (Python):
import numpy as np
X=int(input())
def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum
B=seachPrimeNum(100100)
for i in range(len(B)):
    if B[i]>=X:
        answer=i
        break
print(B[answer])

Solution (Python):
import math

X = int(input())

def prime(x):
    if x >=3:
        if x % 2 == 0:
            return False
        else:    
            T = True
            i = 2
            while (T == True)&(1 < i <= math.ceil(math.sqrt(x))):
                if x % i == 0:
                    T = False
                i +=1
            return T
    else:
        return True

if X == 2:
    print(2)
elif X % 2 == 0:
    T = X + 1
    while (prime(T) == False):
        T +=2
    print(T)
else:
    T = X
    while (prime(T) == False):
        T +=2
    print(T)

Solution (Python):
def pr(n):
    ip = [True]*(n+1)
    ip[0] = False
    ip[1] = False
    for i in range(2,int(n**0.5)+1):
        if not ip[i]:
            continue
        for j in range(i*2,n+1,i):
            ip[j] = False
            
    return ip[n]
n = int(input())
while True:
    if pr(n) == True:
        print(n)
        exit()
    n += 1

Solution (Python):
import math

x = int(input())
while x > 0:
  for i in range(2, math.floor(x**(1/2))):
    if x % i == 0:
      x += 1
      break
  else:
    print(x)
    break

Solution (Python):

import math

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

x = int(input())

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

print(x)

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

Solution (Python):
def is_prime(n):
    if n <= 1:
        return False
    elif n == 2:
        return True
    elif n % 2 == 0:
        return False
    for i in range(3, n, 2):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return True


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

Solution (Python):
X = int(input())
sosu = "Yes"

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

print(X)