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



Sample input:
20


Sample output:
23

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def get_primenumber(N):
	#素数リスト
	prime_list = [2]
	count = 0
	num = 3
	n2 = 3
	prime_l = [2]
	for num in range(3,N+1,2):
		if all( num % prime != 0 for prime in prime_list):
			prime_list.append(num)

	while(count < 1):
		if all( n2 % p != 0 for p in prime_list):
			prime_l.append(n2)
			count += 1
		n2 += 2

	return prime_l

N = int(input())
check = 0
i = N
l = get_primenumber(N)
print(l[1])

Submission status: Wrong Answer

Solution code:
def factorization(n):# 計算量O(√N)
    arr = {}
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr[i] = cnt

    if temp!=1:
        arr[temp]=1

    if arr==[]:
        arr[n] = 1

    return arr

x = int(input())
print(factorization(x))
while(True):
    p = factorization(x)
    if (len(p)==1) & (x in p):
        print(p)
        break
    else:
        x += 1

print(x)

Submission status: Wrong Answer

Solution code:
def factorization(n):# 計算量O(√N)
    arr = {}
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr[i] = cnt

    if temp!=1:
        arr[temp]=1

    if arr==[]:
        arr[n] = 1

    return arr

x = int(input())

while(True):
    p = factorization(x)
    if len(p)==1:
        break
    else:
        x += 1

print(x)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
flag = 0
ans = 0
for i in range(X,10**5 + 1):
  flag = 0
  if X == 2:
    ans = 2
    break
  for j in range(2,int(math.sqrt(i)) + 1):
    if i % j == 0:
      flag = 1
      break
  if flag == 0:
    ans = i
    break
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math

input=stdin.readline

def isPrime(x):
  if x % 2 == 0:
    return False
  for div in range(3, math.floor(x **(0.5)) + 1,2):
    if x % div == 0:
      return False

  return True

X = int(input())

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

if isPrime(X):
   print(X)
   exit()

while (True):
  X += 2
  if isPrime(X):
    print(X)
    exit()

Submission status: Wrong Answer

Solution code:
import sys
X = int(input())
    
i = X
while True:
    if i % 2 != 0:
        y = 3
        while True:
            if i == y:
                print(i)
                sys.exit()
            elif i % y == 0:
                break
            else:
                y += 2
    i += 1

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
def miller_rabin(n, k=10000):
    import random
    if n == 2:
        return True
    if n == 1 or n & 1 == 0:
        return False
    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1
    for _ in range(k):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)
        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1
        if y != n - 1 and t & 1 == 0:
            return False
    return True
def main():
  x=int(input())
  for i in range(x+1,1000000):
    if miller_rabin(i):
      print(i)
      return
main()

Submission status: Wrong Answer

Solution code:
def miller_rabin(n, k=100):
    import random
    if n == 2:
        return True
    if n == 1 or n & 1 == 0:
        return False
    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1
    for _ in range(k):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)
        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1
        if y != n - 1 and t & 1 == 0:
            return False
    return True
def main():
  x=int(input())
  for i in range(x+1,1000000):
    if miller_rabin(i):
      print(i)
      return
main()

Submission status: Wrong Answer

Solution code:
def factorization(n):
    res = []
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if n % i == 0:
            cnt = 0
            while n % i == 0:
                cnt += 1
                n //= i
            res.append([i, cnt])

    if n != 1:
        res.append([n, 1])

    return res


x = int(input())

res = x
while len(factorization(res)) > 1:
    res += 1

print(res)

Submission status: Wrong Answer

Solution code:
def factorization(n):
    res = []
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            cnt = 0
            while n % i == 0:
                cnt += 1
                n //= i
            res.append([i, cnt])

    if n != 1:
        res.append([n, 1])

    return res


x = int(input())

res = x
while len(factorization(res)) > 1:
    res += 1

print(res)

Submission status: Wrong Answer

Solution code:
def factorization(n):
    res = []
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            cnt = 0
            while n % i == 0:
                cnt += 1
                n //= i
            res.append([i, cnt])

    if n != 1:
        res.append([n, 1])

    return res


x = int(input())

res = x
while True:
    if len(factorization(res)) == 1:
        print(res)
        break
    res += 1

Submission status: Wrong Answer

Solution code:
x=int(input())
while True:
  cnt=0
  for i in (2,x//2):
    if x%i==0:
      cnt+=1
      break
  if cnt==0:
    print(x)
    break
  else:
    x+=1
    continue

Submission status: Wrong Answer

Solution code:
x=int(input())
while True:
  cnt=0
  for i in (2,x//2):
    if x%i==0:
      cnt+=1
      break
  if cnt==0:
    print(x)
    break
  elif cnt==1:
    x+=1
    continue

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
while True:
  cnt=0
  for i in (2,math.ceil(math.sqrt(x))):
    if x%i==0:
      cnt+=1
      break
  if cnt==0:
    print(x)
    break
  elif cnt==1:
    continue

Submission status: Wrong Answer

Solution code:
x = int(input())
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
while True:
    if is_prime(x) == False:
        x = x+1
    else:
        break
print(x)

Submission status: Wrong Answer

Solution code:
limit = 100000
import math
def resolve():
    N = int(input())
    for k in range(N, limit+1):
        factor = 0
        if k % 2 == 0 and k != 2:
            continue
        for divisor in range(2, math.floor(math.sqrt(k))+1):
            if k % divisor == 0:
                factor += 1
        if factor == 0:
                return k
print(resolve())

Submission status: Wrong Answer

Solution code:
x=int(input())

sosuu=[2];A=10000
for L in range(3,A):
    chk=True
    for L2 in sosuu:
        if L%L2 == 0:chk=False
    if chk==True:sosuu.append(L)
for i in sosuu:
    if x<=i:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())

def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

for i in range(X, 100100):
    if(is_prime(i)):
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(x, 10**5):
    flag = True
    for j in range(2, i):
        if (i % j == 0):
            flag = False
            continue
    if flag:
        print(i)
        break
    else:
        continue

Submission status: Wrong Answer

Solution code:
X = int(input())
if X%2 ==0:
  y = X+1
else:
  y = X
Flag = True
while Flag == True:
  a = int(y**(1/2))
  t = 0
  for i in range(2,a):
    if y % i == 0:
      t = 1
  if t == 0:
    Flag = False
  y += 1
print(y-1)

Submission status: Wrong Answer

Solution code:
X = int(input())
num = X

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


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

Submission status: Wrong Answer

Solution code:
X = int(input())

def check(num):
    max_div = int(num**0.5)
    for div in range(2, max_div+1):
        if num % div == 0:
            return False
    else:
        return True

num = X
while True:
    if num % 2 != 0:
        if check(num):
            print(num)
            break
    
    num += 1

Submission status: Wrong Answer

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

X = int(input())

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

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 0
if x <= 3:
    i = x
else:
    for i in range(x+1,2*x):
        s = 0
        for j in range(2,int(pow(i,0.5))+2):
            if i%j == 0:
                s = 1
                break
        if s == 0:
            break
print(i)

Submission status: Wrong Answer

Solution code:
import math

def isPrime(num):
    if num <= 2:
        return False
    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 find_min_prime(num):
    
    if num % 2 == 0:
        num += 1

    while True:
        if isPrime(num):
            break
        num += 2

    return num


X = int(input())
print(find_min_prime(X))

Submission status: Wrong Answer

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

n = int(input())

for i in range(n,10**5):
  if isPrime(i):
    print(i)
    break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n=int(input())
f=0
while 1:
    for i in range(2,n//2+1):
        if n%i==0:
            break
        elif i==n//2:
            f=1
            break
    if f==1:
        print(n)
        break
    n+=1

Submission status: Wrong Answer

Solution code:
import math


def is_prme_number(num):
    if num == 1:
        return False

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

    return True


def main():
    x = int(input())
    while True:
        x += 1
        if is_prme_number(x):
            break
    print(x)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
x=int(input())

for i in range(x,10**9):
    cnt=0
    for j in range(2,i):
        if i%j==0:
            continue
        else:
            cnt+=1
            if cnt==i-2:
                print(i)
                exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(10^5):
  n = 2
  while x % n != 0 and n <= x**0.5 + 2:
    n += 1
  if n < x**0.5 + 2:
    x += 1
    
  else:
    print(x)
    break

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(10^5):
  n = 2
  while x % n != 0 and n <= x/2:
    n += 1
  if n < x/2:
    x += 1
    
  else:
    print(x)
    break

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(10^5):
  n = 2
  while x % n != 0 and n <= x/2:
      n += 1
  if n <= x/2:
    x += 1
    
  else:
    print(x)
    break

Submission status: Wrong Answer

Solution code:
x = int(input())

import math
x_sq = math.sqrt(x)
x_sq_it = int(x_sq)

pnlist = [2]

countn = 0
for i in range(2,x_sq_it+1):
    for j in range(len(pnlist)):
        if i % pnlist[j] == 0:
            break
        else:
            countn += 1
    if countn == len(pnlist):
        pnlist.append(i)
        countn = 0

countn = 0

if x in pnlist:
    print(x)
else:
    for i in range(x,10**5):
        for j in range(len(pnlist)):
            if i % pnlist[j] == 0:
                break
            else:
                countn += 1
        if countn == len(pnlist):
            print(i)
            exit()
        else:
            countn = 0

Submission status: Wrong Answer

Solution code:
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, 7//2, 2):
        if x % i == 0:
            break
      else:
        print(x)
        break
    x += 1

Submission status: Wrong Answer

Solution code:
import sys
x = int(input())
for i in range(x+1,100005):
    c = 0
    for j in range(1,i+1):
        if i%j != 0:
            c += 1
    if c == i-2:
        print(i)
        sys.exit()

Submission status: Wrong Answer

Solution code:
def is_prime(q):
    if q == 1:
        return False
    elif q == 2:
        return True
    elif q & 1 == 0:
        return False
    return pow(2, q - 1, q) == 1


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)

Submission status: Wrong Answer

Solution code:
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):
    X+=1
    if(prime_l[X]==0):
        print(X)
        sys.exit(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
import numpy as np
while True:
  n+=1
  r=True
  #print(n)

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

  #exit()
  if r:
    print(n)
    exit()

Submission status: Wrong Answer

Solution code:
# ABC149B

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(100000)
for i, p in enumerate(prime):
    if p >= x:
        print(prime[i])
        break

Submission status: Wrong Answer

Solution code:
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==1 or 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

Submission status: Wrong Answer

Solution code:
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==1 or 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

Submission status: Wrong Answer

Solution code:
import sys
x=int(input())
if x==2:
    print(x)
    sys.exit()
a=[i for i in range(3,x+1) if i%2!=0]
b=[2]
for i in a:
    if all(i%j!=0 for j in b):
        b.append(i)
if x%2==0:
    x=x+1

while True:
    if all(x%i!=0 for i in b):
        print(x)
        sys.exit()
    else:
        x=x+2

Submission status: Wrong Answer

Solution code:
def is_prime(n, k=100):
    n = abs(n)
    if n == 2:
        return True
    if n < 2 or n&1 == 0:
        return False
    for i in range(3, k):
        x, y = n, i
        while y:
            x, y = y, x%y
        if x != 1:
            continue
        if pow(2, n-1, n) != 1:
            return False
    return True


X = int(input())

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

Submission status: Wrong Answer

Solution code:
def is_prime(n):
    n = abs(n)
    if n == 2: return True
    if n < 2 or n&1 == 0: return False
    return pow(2, n-1, n) == 1


X = int(input())

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

Submission status: Wrong Answer

Solution code:

X=int(input())

def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

i=X
while 1==1:
    if is_prime(i)==True:
        print(i)
        quit()
    i+=1

Submission status: Wrong Answer

Solution code:
x = int(input())


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

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

Submission status: Wrong Answer

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


# input
X = int(input())

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

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = 0

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

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = 0

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

Submission status: Wrong Answer

Solution code:
n=int(input())
x=n+1
while x>n:
    if n==2:
        print(2)
        break
    for i in range(2,x):
        if x%i==0:
            x+=1
            break
        else:
            continue
    else:
        print(x)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
i=2
s={2}
while(i<x):
    i+=1
    mkr=0
    for j in s:
        if i%j==0:
            mkr=1
            break
    if mkr==0:
        s|={i}
while(1):
    i+=1
    mkr=0
    for j in s:
        if i%j==0:
            mkr=1
            break
    if mkr==0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
X=int(input())


while True:  
  if X % 2 == 0 and X != 2:
    X=X+1
    continue
  
  if X==2:
    print(2)
    exit()
            
  if pow(2, X-1, X) == 1:
    print(X)
    exit()
    
  X=X+1

Submission status: Wrong Answer

Solution code:
x = int(input())

def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

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

Submission status: Wrong Answer

Solution code:
import math

def fermat(k):
    if k % 2 == 0 and k != 2:
      return False
            
    if pow(2, k-1, k) == 1:
      return True
    else:
      return False

def using_sqrt(k):  
    factor = 0
        
    # 2以外の偶数は素数ではないので無視する
    if k % 2 == 0 and k != 2:
        return False
        
    # 繰り返しの上限を対象の平方根にする
    for divisor in range(2, math.floor(math.sqrt(k))+1):
        if k % divisor == 0:
            factor += 1
                
    if factor == 0:
        return True
    else:
        return False
            
 
  
n=int(input())
while True:
  if fermat(n):
    if using_sqrt(n):
      print(n)
      break
  n+=1

Submission status: Wrong Answer

Solution code:
import random

def fermat(k):
    if k % 2 == 0 and k != 2:
      return False
            
    if pow(2, k-1, k) == 1:
      return True
    else:
      return False

def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False

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

    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)

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

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

    return True    
    
n=int(input())
while True:
  if fermat(n):
    if is_prime(n):
      print(n)
      break
  n+=1

Submission status: Wrong Answer

Solution code:
def fermat(k):
    if k % 2 == 0 and k != 2:
      return False
            
    if pow(2, k-1, k) == 1:
      return True
    else:
      return False

n=int(input())
while True:
  if fermat(n):
    print(n)
    break
  n+=1

Submission status: Wrong Answer

Solution code:
x=int(input())
slist=[]
for i in range(2,x):
  l=list(range(2,i))
  if all(i%ll!=0 for ll in l):
    slist.append(i)
slist.append(2)
while x>0:
  if all(x%ss!=0 for ss in slist):
    print(x)
    exit()
  x+=1

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def furui(n):
  data = [i for i in range(2, 2*n)]
  ans = []
  while True:
    sentou = data[0]
    if sentou >= n:
      return sentou
    ans.append(sentou)
    data = [i for i in range(data[0]+1, n+1) if i % sentou != 0]
    if len(data) == 0:
      return ans
x = int(input())
print(furui(x))

Submission status: Wrong Answer

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


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


while not is_prime(X):
    X += 1

print(X)

Submission status: Wrong Answer

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

    while not flg:
        if n == 2:
            print(n)
            exit()
        if n % 2 == 0:
            n += 1
            continue
        for i in range(3, n // 2 + 1, 2):
            if n % i == 0:
                n += 1
                continue
        print(n)
        exit()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
x = int(input())
z = 0
while(z == 0):
    if x > 1:
        # check for factors
        for i in range(2, x):
            if (x % i) == 0:

                x = x+1
        else:
            print(x)
            z = 1

Submission status: Wrong Answer

Solution code:
import random


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


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


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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())
import math
def is_prime(q):
    if q == 2:
        return True
    if q%2==0: return False
    return pow(2, q-1, q) == 1
while True:
    if is_prime(N):
        print(N)
        exit()
    N += 1

Submission status: Wrong Answer

Solution code:
N = int(input())
import math
def is_prime(q):
    if q == 2:
        return True
    return pow(2, q-1, q) == 1
while True:
    if is_prime(N):
        print(N)
        exit()
    N += 1

Submission status: Wrong Answer

Solution code:
N = int(input())
import math
def is_prime(q):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return int(pow(2, q-1, q)) == 1
while True:
    if is_prime(N):
        print(N)
        exit()
    N += 1

Submission status: Wrong Answer

Solution code:
N = int(input())
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
while True:
    if is_prime(N):
        print(N)
        exit()
    N += 1

Submission status: Wrong Answer

Solution code:
N = int(input())
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
while True:
    N += 1
    if is_prime(N):
        print(N)
        exit()

Submission status: Wrong Answer

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

print(n)

Submission status: Wrong Answer

Solution code:
x=int(input())

sosu=[2,3]

i=4
import math

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

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

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
x = int(input())

# x までの素数を探す
prim_numbers = []
for divider in range(2, int(np.sqrt(x))):
    if x % divider == 0:
        continue
    else:
        prim_numbers.append(divider)


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


# 2 なら終わり
if x == 2:
    print(x)
    exit()
# 偶数なら、奇数だけ調べるようにする
if x % 2 == 0:
    x += 1
while True:
    if is_prim(x):
        print(x)
        exit()
    else:
        x += 2
        continue

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
x = int(input())

# x までの素数を探す
prim_numbers = []
for divider in range(2, int(np.sqrt(x))):
    if x % divider == 0:
        continue
    else:
        prim_numbers.append(divider)


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


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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
x = int(input())

# x までの素数を探す
prim_numbers = [2]
for divider in range(2, int(np.sqrt(x))):
    if x % divider == 0:
        continue
    else:
        prim_numbers.append(divider)


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


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

Submission status: Wrong Answer

Solution code:
X=int(input())

while True:
    if (17**X -17 )%X==0:
        print(X)
        exit(0)

    X+=1

Submission status: Wrong Answer

Solution code:
X=int(input())

while True:
    if (13**X -13 )%X==0:
        print(X)
        exit(0)

    X+=1

Submission status: Wrong Answer

Solution code:
X=int(input())

while True:
    if (11**X -11 )%X==0:
        print(X)
        exit(0)

    X+=1

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import math

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

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

Submission status: Wrong Answer

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

L = X+10000
A = np.array(range(3,L,2))
for i in range(3,int(np.sqrt(L))+100,2):
    A = np.where((A%i == 0) & (A//i != 1), 1, A)

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

Submission status: Wrong Answer

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

L = X+1000
A = np.array(range(3,L,2))
for i in range(3,int(np.sqrt(L))+100,2):
    A = np.where((A%i == 0) & (A//i != 1), 1, A)

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

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

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