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 main():
    x = int(input())
    sosuu = [2]
    A = 200000
    if x == 2:
        print(2)
    else:
        for L in range(3, A, 2):
            for L2 in sosuu:
                if L % L2 == 0:
                    break
            else:
                sosuu.append(L)
                if L >= x:
                    print(L)
                    break
        
if __name__ == '__main__':
    main()

Solution (Python):


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

prime = int(input())

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

print(prime)

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
a = 1

while a == 1:

    if  is_prime(x) == True:
        ans = x
        a = 0
    else:
        x += 1
print(ans)

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


if n in primes(n):
    print(n)
else:
    i = n
    while not isprime(i):
        i += 1
    print(i)

Solution (Python):
x = int(input())
import math
ans = 2
tmp = x
if x!=2:
    if x%2==0:
        tmp = x+1
    while True:
        ok = True
        for k in range(3, int(math.sqrt(tmp))+1):
            if tmp % k == 0:
                ok = False
                break
        if ok:
            ans = tmp
            break
        else:
            tmp+=2
print(ans)

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

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

isprime = False
while isprime == False:
  check = False
  for i in range(X):
    if i >= 2:
      if X % i == 0:
        check = True
        break
  if check == False:
    isprime = True
  else:
    X += 1
print(X)

Solution (Python):
import sys
input = sys.stdin.readline
X=int(input().rstrip())
maxX=10**6

def resolve():
    check,table=sieve(maxX)

    for a in table:
        if a>=X:
            print(a)
            return

def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [ i for i in range(1, n+1) if is_prime[i-1]]
    is_prime=[False]+is_prime 
    return is_prime, table


import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """20"""
        output = """23"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """2"""
        output = """2"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """99992"""
        output = """100003"""
        self.assertIO(input, output)

if __name__ == "__main__":
    
    resolve()

Solution (Python):

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


N=int(input())

i=0
while(True):
    if cal(N+i):
        print(N+i)
        exit()
    else:
        i+=1

Solution (Python):


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

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

print(ans)

Solution (Python):


import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def MI() : return map(int, input().split())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}; print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

X = I()

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

p = primes(1000000)

for pp in p:
    if pp >= X:
        print(pp)
        break

Solution (Python):
a = int(input())
mx = int(3e5)
num = [1 for _ in range (mx+1)]
import math
limit = int(math.sqrt(mx))
for i in range(2,limit):
    if num[i] == 1:
        cur = 2*i
        while cur < mx:
            num[cur] = 0
            cur+=i
for i in range(a,mx+1):
    if num[i] == 1:
        print(i)
        break

Solution (Python):

si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

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

x=ni()

for i in range(x,10**6+1):
    if isPrime(i):
        print(i)
        exit()

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

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


def check_prime(n):
    if n % 2 == 0:
        return False

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

    return True

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

while True:
    if check_prime(x):
        print(x)
        exit()
        break

    x += 2

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

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

if __name__ == "__main__":
    main()

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

i = 2
while True:
    
    if i == X:
        break
    if X % i == 0:
        X += 1
        i = 2
    
    else:
        i += 1
    

    
print(X)

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

while 1:
    if is_prime(a):
        print(a)
        break
    a+=1

Solution (Python):
x=int(input())
sosu=[]
for i in range(2,10**5+1000):
  temp=2
  flag=1
  while temp**2<=i:
    if i%temp==0:
      flag=0
      break
    temp+=1

  if flag==1:
    sosu.append(i)

import bisect

a=bisect.bisect_left(sosu,x)
print(sosu[a])

Solution (Python):
def com(_x):
    _flg = 1
    mx  = int(_x**0.5)
    for i in range(2, mx+1):
        if _x % i == 0:
            _flg = 0
            break
    return _flg


def main():
    x = int(input())
    flg = 0
    while flg == 0:
        
        flg = com(x)
        if flg == 0:
            x+=1
    print(x)



if __name__ == "__main__":
    main()

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

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

print(ans)

Solution (Python):
import math
x = int(input())
check = False
check2 = False
a = x
if a % 2 == 0 and a != 2:
    a += 1
while check == False:
    b = math.floor(a/2)
    for i in range(2,b+1):
        if a % i == 0:
            check2 = True
            break
        else:
            pass
    if check2 == True:
        a += 2
        check2 = False
    else:
        check = True
        break
print(a)

Solution (Python):
import bisect
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 [i for i in range(n + 1) if is_prime[i]]

prime_list = primes(x+500)
index = bisect.bisect_left(prime_list,x)
print(prime_list[index])

Solution (Python):
def main():
    x=int(input())
    flg = 1
    ans = 0
    if x == 2:
        print(2)
        return
    while flg == 1:
        if x % 2 == 0:
            x+=1
            continue
        else:
            flg=0
            for i in range(3,int(x**0.5)+1):
                if x % i == 0:
                    flg = 1
                    break
            if flg == 0:
                ans = x
                print(ans)
                return
            x+=1


if __name__=='__main__':
    main()

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

x = int(input())
for i in primes(10**6):
    if i>=x:
        print(i)
        exit()

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

import math

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

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

    return True

if x==2:
    print(2)
elif x%2==0:
    for i in range(1,10000,2):
        if is_prime(x+i):
            print(x+i)
            exit()
        else:
            pass
else:
    for i in range(0,10000,2):
        if is_prime(x+i):
            print(x+i)
            exit()
        else:
            pass

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 is_prime(x)==False:
    if x%2==0:
        x+=1
    else:
        x+=2
    
print(x)

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

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

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

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

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

Solution (Python):
from math import ceil, sqrt
n = int(input())

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

n = n+1 if n % 2 == 0 else n

notPrime = True
while notPrime:
    notPrime = False
    for i in range(2, ceil(sqrt(n))):
        if n % i == 0:
            n += 2
            notPrime = True
            break


print(n)

Solution (Python):
def prime_list(n):
	l=[0]*n
	if n<4:
		for i in range(2,int(n**0.5)):
			if l[i]==0:
				for j in range(i*2,n,i):
					l[j]=1
		return [k for k in range(2,n) if l[k]==0]
	else:
		for i in range(2,max(int(n**0.5),4)):
			if l[i]==0:
				for j in range(i*2,n,i):
					l[j]=1
		return [k for k in range(2,n) if l[k]==0]
		
pl=prime_list(10**5+1000)
n=int(input())
for i in pl:
	if i>=n:
		print(i)
		exit()

Solution (Python):
import math
import itertools


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


X = int(input())
for n in itertools.count(start=X):
    if is_prime(n):
        print(n)
        break

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

Solution (Python):
n = int(input())
prime = []
count = 2
while True:
    tf = 1
    for i in prime:
        if count%i == 0:
            tf = 0
            break
    if tf == 1:
        prime.append(count)
        if count >= n:
            print(count)
            break
    count += 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())
result = 0
while result == 0:
    if is_prime(X):
        result = X
    else:
        X += 1
print(X)

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

Solution (Python):
def primeFactorize(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, 10000000000):
        a = primeFactorize(i)
        if len(a) == 1:
                print(i)
                break

Solution (Python):

X = int(input())


import numpy as np

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

l = seachPrimeNum(10**5+3)


for i in l:
    if i >= X:
        print(i)
        break

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

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

for i in range(x, 10 ** 6 + 1):
    for j in range(2, i):
        if j == i - 1:
            print(i)
            exit()
        if i % j == 0:
            break

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

Solution (Python):
x = int(input())
flg = 0
def isPrimenum(n):
	if n < 2:
		return False
	if n == 2:
		return True
	for p in range(2, n):
		if n % p == 0:
			return False
	return True
while flg == 0:
	if isPrimenum(x) == True:
		flg = 1
		break
	x += 1
print (x)

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

for xi in range(x,10000000):
    if is_prime(xi):
        print(xi)
        sys.exit()
    else:
        continue

Solution (Python):
import sys
input = sys.stdin.buffer.readline

def init_prime(n_max: int):
    """ https://qiita.com/fantm21/items/5e270dce9f4f1d963c1e
    
    """
    if n_max <= 1: return []
    if n_max == 2: return [2,]
    prime = [2,]
    _app_p = prime.append
    n_rt = int(n_max**.5)
    data = list(range(3, n_max+1, 2))
    while data:
        p = data[0]
        if p > n_rt:
            return prime + data
        _app_p(p)
        data = [e for e in data if e%p]


def main():
    N = int(input())
    vP = init_prime(N+50000)
    
    
    
    for p in vP:
        if p >= N:
            print(p)
            return


if __name__ == "__main__":
    main()

Solution (Python):
import math


X=int(input())

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

Is = isPrime(X)
while Is == False:
    X+=1
    Is =isPrime(X)

print(X)

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

import random

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

for i in range(X, X + 100):
    if is_prime3(i) == True:
        print(i)
        exit()

Solution (Python):
import numpy as np
x=int(input())
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
while True:
    if is_prime(x)==True:
        print(x)
        break
    else:
        x+=1

Solution (Python):
x = int(input())
import numpy as np

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

l = seachPrimeNum(100010)
i = 0
while l[i] < x:
  i += 1
print(l[i])

Solution (Python):
import math

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

x = int(input())
while True:
    a = is_prime(x)
    if a:
        print(x)
        exit()
    else:
        x+=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 [i for i in range(n + 1) if is_prime[i]]
data = primes(2*X)
for i in range(len(data)):
    if data[i] >= X:
        ans = data[i]
        break
print(ans)

Solution (Python):


import math
def prime_number(start, end):
    
    if start < 3:
        return 2
    if start % 2 == 0:
        start = start + 1
    else:
        start = start

    
    for i in range(start, end+1, 2):
        prime = True
        if i == 1:
            prime = False
            continue
        for j in range(2, math.floor(math.sqrt(i))+1):
            if i%j == 0:
                prime = False
                break
        if prime:
            return i

n = int(input())
print(prime_number(n, 1000000))

Solution (Python):
import math

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

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

    return True
  
N = int(input())

while is_prime(N) == False:
  N = N+1
print(int(N))

Solution (Python):
import math
def is_prime(x):
    if x < 2: return False 
    if x == 2 or x == 3 or x == 5: return True 
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False 

    
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True

X = int(input())
for i in range(X,10**8+1):
    if is_prime(i):
        print(i)
        break

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

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

import random
def is_prime3(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

while True:
     if is_prime3(n):
         break
     n+=1
print(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) == 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 n != 1
    
while True:
    ans = is_prime(x)
    if ans == True:
        print(x)
        exit()
    else:
        x += 1

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

Solution (Python):
import math

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

    if n == 2:
        return True

    if n % 2 == 0:
        return False

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

    return True


X = int(input())
while True:
    if is_prime(X):
        print(X)
        break

    X += 1

Solution (Python):
import math

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

main()

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

def isPrime(n):
    if n == 2:
        return True
    i = 2
    m = math.ceil(math.sqrt(n))
    flag = True
    while i <= m:
        if n % i == 0:
            flag = False
            break
        i += 1
    return flag

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

Solution (Python):
X = int(input())
V = [False]*110000
for n in range(2, 110000):
  if n*n > X+10000:
    break
  if not V[n]:
    for i in range(2, 110000):
      if i*n < len(V):
        V[i*n] = True
for n in range(X, 110000):
  if not V[n]:
    print(n)
    exit()

Solution (Python):
def sieve(n):
  ass = []
  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
  for i in range(n+1):
    if is_prime[i]:
      ass.append(i)
  return(ass)

x = int(input())
l = sieve(10**5+4)
l_ = set(l)

import bisect
if x in l_:
  print(x)
else:
  print(l[bisect.bisect_right(l,x)])

Solution (Python):
total = 9593
primes = [0] * total
primes[0] = 2
x = 1
k = 1
while (k < total):
    x += 2
    j = 0;
    while (j < k and x % primes[j] != 0):
        if (primes[j] * primes[j] >= x):
            primes[k] = x
            k = k + 1
            break
        j = j + 1


X = int(input())
for p in primes:
    if p >= X:
        print(p)
        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 not is_prime(X):
    X += 1

print(X)

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

num = int(input())
hantei = False
while hantei == False:
    hantei = func(num)
    num+=1
print(num-1)

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

def is_prime2(q,k=100):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    for i in range(3,k):
        x,y = q,i
        while y:
            x, y =  y, x % y
        if x != 1: continue
        if pow(i, q-1, q) != 1:
            return False
    return True
if X==2:
  print(X)
  exit()
if X%2==0:
  X+=1
while not is_prime2(X):
  X+=2
print(X)

Solution (Python):
import math


def isPrime(num):
    
    if num < 2: return False
    
    elif num == 2: return True
    
    elif num % 2 == 0: return False

    
    
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    
    return True


def callIsPrime(input_num):
    
    for i in range(input_num, input_num+1000):
        if isPrime(i):
            primenumber = i
            break

    
    return primenumber

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

    ans = callIsPrime(X)

    print(ans)
 
if __name__ == '__main__':
    main()

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

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

import random

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

for i in range(10**5):
    if is_prime3(x+i):
        print(x+i)
        break

Solution (Python):
import math
from bisect import bisect_left
x = int(input())
def primes(x):
    if x < 2: return []
    primes = [i for i in range(x)]
    primes[1] = 0
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0
    return [prime for prime in primes if prime != 0]

L = primes(10**5 + 20)
if x in L:
    print(x)
else:
    print(L[bisect_left(L, x)])

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

is_prims_dict = {n: True for n in range(2, 3200)}

for n in range(2, 3200):
  for m in range(n+1, 3200):
    if m % n == 0:
      is_prims_dict[m] = False

primes = [k for k, v in is_prims_dict.items() if v]

for ans in range(x, 2 * x):
  if all([ans == prime or ans % prime != 0 for prime in primes]):
    print(ans)
    break;

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

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

Solution (Python):
lower = int(input())
upper = 100000000000

for num in range(lower, upper + 1):
   if num > 1:
       for i in range(2, num):
           if (num % i) == 0:
               break
       else:
           print(num)
           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

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

Solution (Python):
import math

x = int(input())

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

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

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

X = int(input())

for i in range(10**5):
  if prime(X):
    print(X)
    break
  else:
    X+=1

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

flag = True

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

print(x - 1)

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

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

Solution (Python):
import math

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

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

    return True

x = int(input())
for i in range(10**5):
    if is_prime(x+i):
        print(x+i)
        break

Solution (Python):
import math

def is_prime(x):
    if x < 2: return False
    if x == 2 or x == 3 or x == 5: return True
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False
        prime += step
        step = 6 - step
    return True

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

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

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

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

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

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

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

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

Solution (Python):
import math
MAX_X = 10**5 + 1000

pt = [True]*MAX_X
pt[0], pt[1] = False, False

for i in range(2, int(math.sqrt(MAX_X))+1):
    for j in range(2*i, MAX_X, i):
       pt[j] = False

primes = [ idx for idx, num in enumerate(pt) if num == True]

X = int(input())

for prime in primes:
    if X <= prime:
        print prime
        break

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

n=int(input())

for i in range(n,1000001):
    if is_prime(i):
        print(i)
        break

Solution (Python):
x = int(input())
max_i = 10**6
nums = 10**6
num = {i:True for i in range(2,10**6+1)}
i = 2
while i < nums:
    if num[i] == True:
        j = i
        k = j
        while j * k  <= nums:
            num[j*k] = False
            k += 1    
    i += 1
primes = [k for k,v in num.items() if v == True]
primes = [i for i in primes if i >=x]


print(min(primes))