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 s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)









X=n0()

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

sosuu=primes((10**5)+1000)
while True:
    if X in sosuu:
        print(X)
        break
    X+=1

Solution (Python):
import math

X = int(input())
for i in range(X,10**6):
    for j in range(2,int(math.sqrt(X))+1):
        if i%j==0:
            break
    else:
        ans = i
        break
print(ans)

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

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

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

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

fact = [True] * (10 ** 5 + 1000)
fact[0],fact[1] = False,False
for i in range(2,len(fact)):
  if fact[i]:
    for j in range(i * 2, len(fact), i):
      fact[j] = False
      
for i in range(X,len(fact)):
  if fact[i]:
    print(i)
    break

Solution (Python):
x=int(input())
ans=False
for i in range(x,10**9):
    if ans==True:
        break
    else:
        cnt=0
        for j in range(2,i+1):
            if i%j==0 and j!=i:
                continue
            else:
                cnt+=1
                if cnt==i-1:
                    print(i)
                    ans=True

Solution (Python):
import math

def isPrimeNumber(_val):
	if _val < 2:return False
	if _val == 2:return True
	if _val % 2 == 0:return False

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

	return True

X = int(input())
while(1):
	if isPrimeNumber(X):break
	X+=1
print(X)

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())
p = primes(10 ** 5 + 3)
print([i for i in p if i >= X][0])

Solution (Python):

import math

X=int(input())


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=1000):
    numbers = []
    
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    
    return numbers


P=callIsPrime(2*10**5)

for i in range(len(P)):
    if P[i]>=X:
        print(P[i])
        break

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

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

for i in range(x,10**111):
  for j in range(2,(i//2)+2):
    tmp += 1
    if tmp == (i//2):
      print(i)
      exit()
    elif i%j == 0:
      tmp = 0
      break

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

if x == 2:
  print(2)
  exit()
for i in range(x,10**111):
  for j in range(2,(i//2)+2):
    tmp += 1
    if i%j == 0:
      tmp = 0
      break
    elif tmp == (i//2):
      print(i)
      exit()

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

if x == 2:
  print(2)
  exit()
for i in range(x,10**111):
  for j in range(2,(i//2)+2):
    tmp += 1
    if i%j == 0:
      break
    elif tmp == (i//2):
      print(i)
      exit()

Solution (Python):
import re
def main():
    X=int(input()) 
    while True:
        if is_prime(X):
            print(X)
            return
        X += 1


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


if __name__ == '__main__':
    main()

Solution (Python):
from bisect import bisect_left


def get_primes(n):
    prime = []
    limit = n ** 0.5
    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]


X = int(input())
primes = get_primes(10 ** 5 + 3)
print(primes[bisect_left(primes, X)])

Solution (Python):
X = int(input())
for x in range(X, 10**6):
  if all(x % i != 0 for i in range(2, x)):
    print(x)
    break

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

def sosuu(n):
    for j in range(2,int(n**0.5)+1):
        if n % j ==0:
            return 0
    return 1

for i in range(x,10**6):
    if sosuu(i) ==1:
        print(i)
        break

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

Solution (Python):
x=int(input())
f=0
if x == 2:
	print(2)
else:
	for i in range(x,10**6):
		for j in range(2,i//2+2):
			if i%j == 0:
				break
		else:
			f=i
			break
	print(f)

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

ans = -1
x = N
while(ans == -1):
    if all([x % i != 0 for i in range(2, x)]):
        ans = x
    else:
        x += 1
print(ans)

Solution (Python):

Number=int(input())
flg =0

if Number ==2: 
    flg=1
    print(Number)
elif Number%2==0:
    Number+=1

Odd_Number_List =[i for i in range(3,Number,2)]

while flg==0:
    Amari_List = list(map(lambda x:Number%x,Odd_Number_List))
    if Amari_List.count(0)==0:
        flg=1
        print(Number)
        
    else:
        Odd_Number_List.append(Number)
        Number+=2

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

while True:
  n = 2
  while x % n != 0 and n <= x/2:
    n += 1
  if n < x/2:
    x += 1
    
  else:
    print(x)
    break

Solution (Python):
def prime(N):
    p=set(range(2,N+1))
    for i in range(int(N**.5)+1):
        if i in p:
            p-=set(range(i*2,N+1,i))
    return p
N=2*10**5
p=prime(N)
X=int(input())
for i in range(X,N+1):
    if i in p:
        print(i)
        break

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

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

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

Solution (Python):
import sys
import math
import itertools

rl = sys.stdin.readline
x = int(rl())
while True:
    if x == 2:
        print(2)
        break
    if x % 2:
      for i in range(3, x//2, 2):
        if x % i == 0:
            break
      else:
        print(x)
        break
    x += 1

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def is_prime(num):
	if num < 2:
		return False
	if num in [2, 3, 5]:
		return True
	if num%2 == 0 or num%3 == 0 or num%5 == 0:
		return False
	prime = 7
	step = 4
	num_sqrt = sqrt(num)
	while prime <= num_sqrt:
		if num%prime == 0:
			return False
		prime += step
		step = 6 - step
	return True

X = INT()

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

Solution (Python):
def is_prime(q):
    if q < 2:
        return False

    p = 2
    while p * p < q:
        if q % p == 0:
            return False
        p += 1

    return True


X = int(input())

if not is_prime(X):
    if X & 1 == 0:
        X += 1

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

print(X)

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

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

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

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

while True:
  cnt = 0
  for i in range(1, X + 1):
    if X % i != 0:
      continue
    else:
      cnt += 1
  if cnt == 2:
    print(X)
    exit()
  X += 1

Solution (Python):


import sys
sys.setrecursionlimit(300000)

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

def solve(X: int):
    while True:
        if is_prime(X):
            ret = X
            break
        X += 1
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  
    solve(X)

if __name__ == '__main__':
    main()

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

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

ans = -1
x = N
while(ans == -1):
    if all([x % i != 0 for i in range(2, x)]):
        ans = x
    else:
        x += 1
print(ans)

Solution (Python):
import math
import sys
X = int(input())
flag = 0
cnt = 0

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

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

print(result)

Solution (Python):
x=int(input())
f=0
if x == 2:
	print(2)
else:
	for i in range(x,10**6):
		for j in range(2,i//2+2):
			if i%j == 0:
				break
		else:
			f=i
			break
	print(f)

Solution (Python):
X=int(input())
prime=[2]
for i in range(3,10**5+10**4):
  for k in prime:
    if i%k==0:
      break
    if k==prime[-1]:
      prime+=[i]
for i in prime:
  if i>=X:
    ans=i
    break
print(ans)

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

f=True
while f:
    f=False
    for i in range(2,int(n/2)+1):
        if n%i==0:
            f=True
            n+=1
            break
    

print(n)

Solution (Python):
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))



X=int(input())

prime_l=[0]*(2*X)
for  i in range(2,X):
    if(prime_l[i]==0):
        for j in range(1,(2*X)//i):
            prime_l[i*j]+=1
        
while(1):
    if(prime_l[X]==0):
        print(X)
        sys.exit(0)
    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
n = int(input())
while n:
    if is_prime(n):
        print(n)
        break
    n += 1

Solution (Python):
import math



def inp():
    return(int(input()))



def inlist():
    return(list(map(int, input().split())))



def instr():
    s = input()
    return(list(s[:len(s)]))



def invr():
    return(map(int, input().split()))


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

    return True


n = inp()

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

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

n = 10**6
flag = [True]*(n+1)

for i in range(4, n+1, 2):
  flag[i] = False
  
t = int(n**0.5)+1
for i in range(3, t, 2):
  for j in range(i+i, n+1, i):
    flag[j] = False

for i in range(x,n+1):
  if flag[i]:
    print(i)
    exit()

Solution (Python):
import math

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

    return True

X = int(input())
i = 0
while(1):
    if(is_prime(X + i)):
        print(X + i)
        break
    i += 1

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

import math
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(x):
        print(x)
        exit()
    else:
        x=x+1

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


def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): 
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): 
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} 
def bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

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

for i in range(x,10**6,2):
	flg = 1
	for j in range(3,int(i**0.5),2):
		if i%j==0:
			flg = 0
			break
	if flg:
		print(i)
		break

Solution (Python):
import bisect


def read():
    X = int(input())
    return X,

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

def solve(X):
    primes = sieve(2*X)
    idx = bisect.bisect_left(primes, X)
    return primes[idx]

if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))

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

for i in range(n, 10**6):
    flag = True
    for j in range(2, i):
        if i%j == 0:
            flag = False
            break
    if flag:
        print(i)
        exit()

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

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

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):
x = int(input()) 
ans = -1
if x == 2: ans = 2
for i in range(x, x+10**5+1):
    f = True
    for j in range(2, int(x**0.5)):
        if i%j==0:
            f = False
            break
    if f:
        ans = i
        break
print(ans)

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X = INT()
ans = 0
def DFS(X):
	for i in range(2, int(sqrt(X))+1):
		
		if X%i == 0:
			return DFS(X+1)
			break
	else:
		return X

print(DFS(X))

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

half = int(X/2)
i = X
while i >=X:
    for j in range(2,int(i/2)):
        if fractions.gcd(i,j) == 1:
            pass

        else:
            i += 1
            continue

    print(i)
    exit()

Solution (Python):
x = int(input())
if x == 2:
    print(2)
    exit()
i = 3
f = False
while True:
    if x % 2 == 0:
        x += 1
        continue
    while i * i <= x:
        if x % i == 0:
            i += 2
            f = True
            break
        else:
            i += 2
    if not f:
        print(x)
        exit()
    x += 1
    i = 3
    f = False

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())
inf = 10**6
for i in range(x,inf):
    if is_prime(i):
        print(i)
        exit()

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def SS(): return map(str,sys.stdin.readline().rstrip().split())
def II(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def seachPrimeNum(N):
    max = int(numpy.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
prime = seachPrimeNum(10**5 + 3)
X = I()

print(min([i for i in prime if i >= X]))

Solution (Python):
import numpy as np

X= int(input())

ans = X

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

while True:
    if solve(ans):
        break
    ans += 1

print(ans)

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

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

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

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

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

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

i=X
isSosu=False
while True:
  if i==2:
    print(i)
    break

  j=2
  while j*j<=i:
    if i%j==0:
      break
    j+=1

    if j*j>i :
      print(i)
      isSosu=True
      break

  i+=1
  if isSosu:
    break

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

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

    if flag:
        print(x)
        sys.exit()

    x += 1

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

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

Solution (Python):
n=int(input())
import numpy as np
while True:
  r=True
  

  for ii in np.arange(2,n//2):
    
    if n//(ii+1)==n/(ii+1):
      r=False
      break

  
  if r:
    print(n)
    exit()
  n+=1

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


i = X

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

print(i)

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

for i in range(X,10**5+3+1):
    for j in range(2,10**5):
        a=True
        if i!=j:
            if i%j==0:
                a=False
                break
        else:
            None
    if a==True:
        print(i)
        break

Solution (Python):


X = int(input())

N = 10**5 + 10

Fresh = [False, False] + [True] * (N-1)

for i in range(int((N+1)**0.5) + 1):

    if(Fresh[i] == True):
        for j in range(i*2, N+1, i):
            Fresh[j] = False
        



for i in range(X, N+1):
    if(Fresh[i] == True):
        print(i)
        break

Solution (Python):
import numpy as np

def Eratosthenes(n):
	''' n 以下の素数をエラトステネスの篩で生成 '''
	tbl = np.ones(n+1, dtype=bool)
	tbl[0:2] = False
	for i in range(2, int(np.sqrt(n))+1):
		if tbl[i]:
			tbl[2*i::i] = False
	return np.arange(n+1)[tbl]

x = int(input())

prime = Eratosthenes(100003)
for i, p in enumerate(prime):
    if p >= x:
        print(prime[i])
        break

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

def is_prime(n):
  if n == 2:
    return True
  elif n == 1 or n%2 ==0:
    return False
  else:
    m = 3
    while m*m <= n:
      if n % m == 0:
        return False
      else:
        m += 2
    return True

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

Solution (Python):
import math

x=int(input())

for i in range(x,10**5+100):
    fact_flag = True
    for divisor in range(2,math.floor(math.sqrt(i)+1)):
        if i % divisor ==0:
            fact_flag = False
            break
    if fact_flag:
        print(i)
        exit()

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

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

Solution (Python):
import math as mt

s = int(input())
def check(x):
    a = [i for i in range(2,int(mt.sqrt(x))+1,1)]
    if all([x%j != 0 for j in a]):
        return False
    else:
        return True

f = True
while f:
    f = check(s)
    s+=1

print(s-1)

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

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

while key == 0:
    if prim(X):
        key = 1
        break
    X += 1

print(X)

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


X = int(input())

while not is_prime3(X):
    X += 1

print(X)

Solution (Python):
import math
n=int(input())
flag=0
def sosuu(m):
    h=int(math.sqrt(m))
    for i in range(2,h+1):
        if m%i==0:
            return False
    return True

while flag==0:
    
    if sosuu(n):
        flag=1
        break
    n+=1
print(n)

Solution (Python):
import sys
x=int(input())
n = x
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)
if x in primes:
    del primes[-1]
if x==2:
    print(2)
    sys.exit()
if x%2==0:
    x=x+1
while True:
    if all(x%i!=0 for i in primes):
        print(x)
        sys.exit()
    else:
        x=x+2

Solution (Python):

import sys
import time
import unittest
from io import StringIO
import numpy as np


def resolve():
    X = int(input())
    x = np.array([i for i in range(2, -(-X // 2))])
    while 0 in (X % x):
        X += 1
    print(X)


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 assertTLE(self, input):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin

    
    
    

    def setUp(self):
        self.startTime = time.time()

    def tearDown(self):
        t = time.time() - self.startTime
        print('%s: %.3f' % (self.id(), t), flush=True)

    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__":
    if "IS_LOCAL" in locals():
        suite = unittest.TestLoader().loadTestsFromTestCase(TestClass)
        unittest.TextTestRunner(verbosity=0).run(suite)
    else:
        resolve()

Solution (Python):

import math
def is_prime(n):
    if n ==1: return True
    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):
x = int(input())
for i in range(x, 10 ** 6):
    L = list(range(2, i))
    flg = True
    for l in L:
        if i % l == 0:
            flg = False
            break
    if flg == True:
        print(i)
        break

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


if x==2 or x==3:
    print(x)
else:
    i=x
    flag=True
    while i<=100003 and flag==True:
        flag=False
        for j in range(2,int(i**(1/2)//1+1)):
            if i%j==0:
                flag=True
                break
        i+=1
    print(i-1)

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

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

Solution (Python):
def isPrime(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 True:
    if isPrime(n):
        print(n)
        break
    else:
        n += 1

Solution (Python):
X=int(input())
for i in range(X,10**6):
    res=0
    for j in range(2,i):
        if i%j==0:
            res=1
    if res==0:
        print(i)
        exit()

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

i=int(X**0.5)
while i>=2:
    if X%i==0:
        X+=1
        i=int(X**0.5)
    else:
        i-=1

print(X)

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

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

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

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

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

def isPrime(n):
  if n < 2:
    
    return False
  if n == 2:
    
    return True
  for p in range(2, n):
      if n % p == 0:
        
        return False
  
  return True
  
while 1==1:
    if isPrime(X)==True:
        print(X)
        quit()
    X+=1

Solution (Python):
X = int(input())
cnt_0 = 0
cnt_1 = 0
while True:
  cnt_1 = 0
  ref_x = X + cnt_0
  ref_list = [i for i in range(2, ref_x)]
  for i in ref_list:
    if ref_x % i == 0:
      break
    else:
      cnt_1 += 1
  if cnt_1 == len(ref_list):
    print(ref_x)
    break
  cnt_0  += 1

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