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())
x=int(math.sqrt(X))

for i in range(X,100001):
    c=0
    for j in range(2,x+1):
        if i%j != 0:
            continue
        else:
            c=1
            break
    if c==0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
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())
for i in range(n, 10**5+1):
  if is_prime(i):
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
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())
for i in range(n, 10**5+1):
  if is_prime(n):
    print(n)
    exit()

Submission status: Wrong Answer

Solution code:
import math

input_from = input()
info = input_from.split(' ')
a = int(info[0])

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

if a == 2:
    print(2)
else:
    while not is_prime(a):
        a += 1

print("{0}".format(a))

Submission status: Wrong Answer

Solution code:
import math

input_from = input()
info = input_from.split(' ')
a = int(info[0])

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

if a == 2:
    print(2)
else:
    if a % 2 == 0:
        a += 1
    while not is_prime(a):
        a += 2

print("{0}".format(a))

Submission status: Wrong Answer

Solution code:
X = int(input())

if X == 2:
 print(3)

else :

 for i in range(10**6):
  A = 2*i+1
  if A%3 != 0 and A > X:
      break
 print (A)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import sqrt
X = int(input())
flag = 0
if(X == 1):
  print(2)
else:
  ans = X 
  while(flag == 0):
    for i in range(int(sqrt(ans))):
      if(ans % (i + 2) == 0):
        ans += 1
        flag = 0
        break
      flag = 1
  print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt
X = int(input())
flag = 0
ans = X 
while(flag == 0):
  for i in range(int(sqrt(ans))):
    if(ans % (i + 2) == 0):
      ans += 1
      flag = 0
      break
    flag = 1
print(ans)

Submission status: Wrong Answer

Solution code:
num = int(input())

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

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
for i in range(2, int(math.sqrt(x)) + 2):
    if x % i == 0:
        x += 1
print(x)

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
for i in range(2,int(math.sqrt(x))):
    if x % i == 0:
        x += 1
print(x)

Submission status: Wrong Answer

Solution code:
x = int(input())


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

	print(x)
	break

Submission status: Wrong Answer

Solution code:
x=int(input())
from numpy import mod

if x <= 3:
    ans=x
    prime=True
elif mod(x,2)==0:
    prime=False
else:
    # check prime or not
    for i in range(3,x+1,2):
        if mod(x,i)==0:
            if i==x:
                prime=True
                ans=x
            else:
                prime=False
                break
if prime==False: # look for prime
    if mod(x,2)==0:
        x2=x-1
    else:
        x2=x-2
            
    while (prime==False):
        x2= x2+2
        print('x2',str(x2))
        prime=True
        for i in range(3,x2+1,2):
            if mod(x2,i)==0:
                if i==x2:
                    prime=True
                    ans=x2
                else:
                    prime=False
                    break
    

print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
prim = x
flag = True

while(flag):
  for j in reversed(range(2, x)):
    if x % j == 0:
      #print('{} is not prime.'.format(x))
      flag = True
      break
    else:
      num = x
      flag = False
  x += 1
print(num)

Submission status: Wrong Answer

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

print( math.sqrt( p ) )
while True:
  is_composite_number = False
  for i in range( 2, int( math.sqrt( p ))):
    is_composite_number = is_composite_number or ( p % i == 0 )
  if not is_composite_number:
    break
  p += 1
print( p )

Submission status: Wrong Answer

Solution code:
import math
X=int(input())
def isPrime(n):
    if n == 1: return False

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

    return True
  
def callIsPrime(input_num):
    numbers = []
    # ループしながら素数を検索する
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    # 素数配列を返す
    return numbers
  
a = callIsPrime(X)

if X==2:
    print(2);exit()
else:
  if X%2==0:
    X+=1
      
while True:  
  for b in a:
    if X%b==0: 
      X+=2
      continue
  print(X);exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
if n == 2:
    print(2)
    exit()
for i in range(n+1, 10**6):
    for p in range(2, i):
        if i % p == 0:
            break
        elif i-1 == p:
            print(i)
            exit()

Submission status: Wrong Answer

Solution code:
import math
array=[2]
for i in range(3,100003,2):
    prime=True
    for n in range(len(array)):
        if array[n] > math.sqrt(i):
            break
        if i % array[n] == 0:
            prime = False
            break
    if prime:
        array.append(i)
l=int(input())
for m in range(len(array)):
    if l>array[m]:
        pass
    else:
        print(array[m])
        break

Submission status: Wrong Answer

Solution code:
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

def main():
  if is_prime(X) == True:
    print(X)
  else:
    return is_prime(X+1)

if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 10**6
li = [True for i in range(x)]
li[0] = False
li[1] = False

for i in range(int(x**0.5)+1):
    if li[i]:
        m = 2
        while(i*m<x):
            li[i*m] = False
            m += 1
#print(li)
for i in range(x):
    if i>n and li[i]:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
x = int(input())
x += 1
while True:
  xs = [i for i in range(1, x + 1) if x % i == 0]
  if len(xs) == 2:
    break
  x += 1
print(x)

Submission status: Wrong Answer

Solution code:
# Primality test
import numpy as np

n = 100003 # limit

primes = np.ones((n + 1,), dtype=int)
primes[0] = 0
primes[1] = 0
primes[2*2::2] = 0
primes[3*2::3] = 0
m = 5
l = n ** 0.5
while m <= l:
    if primes[m]:
        primes[m * 2::m] = 0
    if m % 6 == 5:
        m += 2
    else:
        m += 4

primes = primes.nonzero()[0]

# solve
X = int(input())
idx = np.where(primes > X)[0][0]
print(primes[idx])

Submission status: Wrong Answer

Solution code:
import math as m
def isprime(n):
  d = int(m.sqrt(n))
  for i in range(2, d+2):
    if n%i==0:
      return False
  return True

n = int(input())

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

Submission status: Wrong Answer

Solution code:
a = [True]*110000
n = 100000
for i in range(2, int(n**0.5) + 1):
	if a[i]:
		for i in range(i*i, n, i):
			a[i] = False
s = int(input())
ans = None
start = s
while not a[start] :
	start += 1
print(start)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def is_prime(x):
    if x == 2:
        return 1
    elif x % 2 == 0:
        return 0
    else:
        return pow(2, x - 1, x) == 1

X = int(input())

while not is_prime(X):
    X += 1

print(X)

Submission status: Wrong Answer

Solution code:
# Python3 implementation of the approach
import math

# Python program to check if
# given number is prime or not


# Function that returns True if n
# is prime else returns False
def isPrime(n):
    # Corner cases
    if (n <= 1):
        return False
    if (n <= 3):
        return True

    # This is checked so that we can skip
    # middle five numbers in below loop
    if (n % 2 == 0 or n % 3 == 0):
        return False

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

    return True


# Function to return the smallest
# prime number greater than N
def nextPrime(N):
    # Base case
    if (N == 2):
        return 2
    elif(N==3):
        return 3

    prime = N
    found = False

    # Loop continuously until isPrime returns
    # True for a number greater than n
    while (not found):
        prime = prime + 1

        if (isPrime(prime) == True):
            found = True

    return prime



def iss(num):
# If given number is greater than 1
   if num==2:
       print(2)

   elif num==3:
       print(3)
   elif num==5:
       print(5)
# Iterate from 2 to n / 2
   for i in range(2, num// 2):

    # If num is divisible by any number between
    # 2 and n / 2, it is not prime
    if (num % i) == 0:
        print(nextPrime(num))
        break
    else:
         print(num)
         exit()
# Driver code
N = int(input())
(iss(N))

Submission status: Wrong Answer

Solution code:
# Python3 implementation of the approach
import math

# Python program to check if
# given number is prime or not


# Function that returns True if n
# is prime else returns False
def isPrime(n):
    # Corner cases
    if (n <= 1):
        return False
    if (n <= 3):
        return True

    # This is checked so that we can skip
    # middle five numbers in below loop
    if (n % 2 == 0 or n % 3 == 0):
        return False

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

    return True


# Function to return the smallest
# prime number greater than N
def nextPrime(N):
    # Base case
    if (N == 2):
        return 2
    elif(N==3):
        return 3

    prime = N
    found = False

    # Loop continuously until isPrime returns
    # True for a number greater than n
    while (not found):
        prime = prime + 1

        if (isPrime(prime) == True):
            found = True

    return prime



def iss(num):
# If given number is greater than 1
   if num==2:
       print(2)

   elif num==3:
       print(3)

# Iterate from 2 to n / 2
   for i in range(2, num// 2):

    # If num is divisible by any number between
    # 2 and n / 2, it is not prime
    if (num % i) == 0:
        print(nextPrime(num))
        break
    else:
         print(num)
         exit()
# Driver code
N = int(input())
(iss(N))

Submission status: Wrong Answer

Solution code:
"""2ずつインクリメントして素数か検証"""
def NextPrime(X):
        while True:
                flag = 1
                for i in range(3, round(X**(1/2)), 2):
                        if X % i == 0:
                                flag = 0
                                break
                if flag == 1:
                        return X
                X += 2


X = int(input())

if X == 2:
        print(X)
        exit()
elif X %2 == 0:  #Xが２でない偶数ならば素数になりえないのでインクリメント
        X += 1
        print(NextPrime(X))

Submission status: Wrong Answer

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

def main():
    N = int(input())
    ls = makePrimeChecker(10**6)
    for i in range(N+1,10**6+1):
        if ls[i]:
            print(i)
            exit()
        

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math

def resolve():
    X = int(input())
    answer = prime_number_from_X(X)

    print("{}".format(answer))

# Trial-division
def prime_number_from_X(X):
    i = X
    while True:
        i_sqrt = int(math.sqrt(i))
        is_prime_number = False
        for j in range(2, i_sqrt):
            if i % j == 0:
                is_prime_number = False
                break
            else:
                is_prime_number = True
        if is_prime_number:
            return i
        i += 1

if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:

import math

X = int(input())

#xが素数か判定する    
def isPrime(x):
    if x == 2:
        return True

    if x < 2 or x % 2 == 0:
        return False
    
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2    
    return True

for i in range(X+1,10**5):
    if isPrime(i):
        print(i)
        break

Submission status: Wrong Answer

Solution code:
import math

n = 10**5+1

x = int(input())

nums = [1 for i in range(n)]

for i in range(2, int(math.sqrt(n))):
  if nums[i] == 0:
    continue
  if (i>x):
    print(i)
    exit()
  for j in range(i+1, n):
    if j%i==0:
      nums[j] = 0

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:
def factorization(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.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

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

    return arr
x = int(input())
b=1
for i in range(x):
  if len(factorization(x+i)) == 1:
    print(x+i)
    break

Submission status: Wrong Answer

Solution code:
x = int(input())

x_ = int(x ** 0.5)

prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331]

idx=0
while True:
    if prime[idx+1] > x_:
        break
    idx += 1
idx+=1

y = x
while True:
    f = True
    for i in prime[:idx]:
        if y % i == 0:
            f = False
            break
    if f:
        break
    else:
        y += 1

print(y)

Submission status: Wrong Answer

Solution code:

import sys
import random
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from operator import add, mul, sub

inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
    
def read_int(): return int(input())
def read_int_n(): return list(map(int, input().split()))
def read_float(): return float(input())
def read_float_n(): return list(map(float, input().split()))
def read_str(): return input().strip()
def read_str_n(): return list(map(str, input().split()))
def error_print(*args): print(*args, file=sys.stderr)

#def INT_(n): return int(n)-1
#def MI(): return map(int,input().split()) # multiple int
#def MF(): return map(float, input().split()) # multiple float
def MI_(): return map(INT_,input().split()) 
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')

def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

 
def mt(f):
    import time
 
    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()
 
        error_print('## code runs for ' ,e - s, 'sec')
        return ret
 
    return wrap

def prime(num):
    for n in range(2,int(sqrt(num))):
        if num % n == 0:
            return False
            break
    return True


_DEBUG = False
#_DEBUG = True

@mt
def solution(K):
    while not prime(K):
        K += 1
    print(K)
    
def test():
    print(prime(5))
 
def main():
    if _DEBUG:
        test()
    else:
        K = read_int()
        print(solution(K))
 
 
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
x = int(input())

# 素数リスト
prime_list = [2]

for num in range(3,x+1,2):
    # 取り出した数字が素数リストの要素で割れなければ素数リストに追加する
    if all(num % prime != 0 for prime in prime_list):
        prime_list.append(num)

while True:
    x += 1
    if all(x % prime != 0 for prime in prime_list):
        break

print(x)

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

Solution code:
input1 = int(input())

n = input1 * 2
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)

for i in range(len(primes)):
    if primes[i] > input1:
        print(primes[i])
        break

Submission status: Wrong Answer

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

n = 100000
ans = primes(n)
x = int(input())
for i in range(x, len(ans)):
	if ans[i]:
		print(i)
		break

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

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

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

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

Submission status: Wrong Answer

Solution code:
import math

def getPrimes(X):
    primes = []
    limit = math.sqrt(X)
    data = [i + 1 for i in range(1, X)]
    while True:
        p = data[0]
        if limit <= p:
            return primes + data
        primes.append(p)
        data = [d for d in data if d % p != 0]

def getNextPrime(primes, X):
    while True:
        if any([X % p == 0 for p in primes]):
            X += 1
        else:
            return X
        
        
X = int(input())
primes = getPrimes(X)
print(getNextPrime(primes, X))

Submission status: Wrong Answer

Solution code:
import math
K = int(input())
if K%2 ==0:K+=1
while True:
        flg =0
        N = int(math.sqrt(K))
        
        for i in range(2,N):
                if K%i == 0:
                    
                        flg = 1
                        break
        if flg == 0:
                print(K)
                break
        K+=2

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

import math

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

Submission status: Wrong Answer

Solution code:
x = int(input())




# 素数を求める
pn = []
for xi in range(2, x+1):
  flag = 1
  for pi in pn:
    if xi%pi==0:
      flag = 0
  if flag == 1:
    pn.append(xi)

#print(pn)

# inputをカウントアップしながら、素数で割れるか確認
while True:
  x += 1
  flag = 1
  for pi in pn:
    if x%pi==0:
      flag = 0
      break
  if flag == 1:
    break

print(x)

Submission status: Wrong Answer

Solution code:
x = int(input())

# 素数を求める
pn = []
for xi in range(2, x+1):
  flag = 1
  for pi in pn:
    if xi%pi==0:
      flag = 0
  if flag == 1:
    pn.append(xi)

print(pn)

# inputをカウントアップしながら、素数で割れるか確認
while True:
  x += 1
  flag = 1
  for pi in pn:
    if x%pi==0:
      flag = 0
      break
  if flag == 1:
    break

print(x)

Submission status: Wrong Answer

Solution code:
x = int(input())

# 素数を求める
pn = [2]
for xi in range(3, x):
  flag = 1
  for pi in pn:
    if xi%pi==0:
      flag = 0
  if flag == 1:
    pn.append(xi)

#print(pn)

# inputをカウントアップしながら、素数で割れるか確認
while True:
  x += 1
  flag = 1
  for pi in pn:
    if x%pi==0:
      flag = 0
      break
  if flag == 1:
    break

print(x)

Submission status: Wrong Answer

Solution code:
x = int(input())
count = 0

from math import sqrt

while count == 0:
  k = 0
  if x % 2 == 0:
    x += 1
  else:
    x += 2
  for i in range(1, x):
    if x % i == 0:
      k += 1
  if k == 1:
    print(x)
    count = 1

Submission status: Wrong Answer

Solution code:
import sys
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

x = int(input())
for i in range(x, 1000000):
    if is_prime(i) == True:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
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

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

Submission status: Wrong Answer

Solution code:

inputA = int(input())

flag = 0
for count in range(inputA+1,300000):
    for mod in range(2,200000):
        if count % mod == 0:
            flag = mod
            break
        mod += 1
    if count == flag:
        print(count)
        break
    else:
        count += 1

Submission status: Wrong Answer

Solution code:

inputA = int(input())

inputA = 99992
flag = 0
for count in range(inputA+1,300000):
    for mod in range(2,200000):
        if count % mod == 0:
            flag = mod
            break
        mod += 1
    if count == flag:
        print(count)
        break
    else:
        count += 1

Submission status: Wrong Answer

Solution code:
from math import sqrt

X = int(input())
not_finded = True
X = X+1 if (X%2 == 0) else X 

def is_prime(X):
    flag = True
    for i in range(3, int(sqrt(X))+1):
        if X % i == 0:
            flag = False
    return flag

while (not_finded):
    if is_prime(X):
        not_finded = False
        print(X)
    else:
        X += 2

Submission status: Wrong Answer

Solution code:
x = int(input())

lp = [0] * 1000005
for i in range(2, 100005):
    if lp[i] == 1:
        continue
    if x < i:
        print(i)
        break

    k = i*i
    while k < 1000005:
        lp[k] = 1
        k += i

Submission status: Wrong Answer

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

while(True):
  flg = True
  if X%2 == 0:
    X += 1
    continue
    
  for i in range(3,X):
    if X%i == 0:
      flg = False
      
  if flg:
    print(X)
    sys.exit()

  X += 2

Submission status: Wrong Answer

Solution code:
X = int(input())
testing_number = X + 1
while(True) :
    is_prime = True
    while(True) :
        for i in range(2,testing_number) :
            if (testing_number % i == 0) :
                is_prime = False
                testing_number += 1
                break
        break

    if(is_prime) :
        break

print(testing_number)

Submission status: Wrong Answer

Solution code:
X = int(input())
pn=[]
A=10000
for L in range(2,A):
    chk=True
    for L2 in pn:
        if L%L2 == 0:
            chk=False
    if chk==True:
        pn.append(L)
        if L >= X:
            print(L)
            break

Submission status: Wrong Answer

Solution code:
X = int(input())
pn=[2]
A=10000
for L in range(3,A):
    chk=True
    for L2 in pn:
        if L%L2 == 0:
            chk=False
    if chk==True:
        pn.append(L)
        if L > X:
            print(L)
            break

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    fermat(n)


def fermat(limit):
    while True:
        # 2以外の偶数は素数ではないので無視する
        if limit == 2:
            print(2)
            break

        if limit % 2 == 0 and limit != 2:
            limit += 1
            continue

        if pow(2, limit-1, limit) == 1:
            print(limit)
            break
        limit += 1
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    fermat(n)


def fermat(limit):
    while True:
        limit += 1
        # 2以外の偶数は素数ではないので無視する
        if limit % 2 == 0 and limit != 2:
            continue

        if pow(2, limit-1, limit) == 1:
            print(limit)
            break

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math
N=int(input())
def isp(N):
  k=int(math.sqrt(N))
  
  for i in range(2,k+2):
    if N%i==0:
      return(False)
  return(True)
while isp(N)==False:
  N+=1
print(N)

Submission status: Wrong Answer

Solution code:
import sys
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

x = int(input())
for i in range(x+1, 1000000):
    if is_prime(i) == True:
        print(i)
        sys.exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
 
for val in range(x, x**1000) :
	if x ==2 :
		print(x)
		break
	elif ((2** (val-1)) % val) == 1 :
		print (val)
		break
	else :
		continue

Submission status: Wrong Answer

Solution code:
x = int(input())
 
for val in range(x, x**1000) :
	if x ==2 :
		print(x)
		break
	elif ((10** (val-1)) % val) == 1 :
		print (val)
		break
	else :
		continue

Submission status: Wrong Answer

Solution code:
x = int(input())
 
for val in range(x, x**1000) :
	if x ==2 :
		print(x)
		break
	elif ((10** val) % val) == 10 :
		print (val)
		break
	else :
		continue

Submission status: Wrong Answer

Solution code:
n = int(input())
x=0
while(1):
  for i in range (int((-(-n**0.5//1)))):
    if n%(i+1)==0:
      x=x+1
  if x==1:
    break
  else:
    x=0
    n=n+1
print(n)

Submission status: Wrong Answer

Solution code:
x = int(input())
 
for val in range(x, x**100) :
	if x ==2 :
		print(x)
		break
	elif ((2** (val-1)) % val) == 1 :
		print (val)
		break
	else :
		continue

Submission status: Wrong Answer

Solution code:
x = int(input())
 
for val in range(x, x**10000) :
	if x ==2 :
		print(x)
		break
	elif ((2** val) % val) == 2 :
		print (val)
		break
	else :
		continue

Submission status: Wrong Answer

Solution code:
x = int(input())
 
for val in range(x+1, x**100) :
	if x ==2 :
		print(x)
		break
	elif ((2** val) % val) == 2 :
		print (val)
		break
	else :
		continue

Submission status: Wrong Answer

Solution code:
x = int(input())
 
for val in range(x, x**1000) :
	if x ==2 :
		print(x)
		break
	elif ((2** val) % val) == 2 :
		print (val)
		break
	else :
		continue

Submission status: Wrong Answer

Solution code:
x = int(input())
 
for val in range(x, x**100) :
	if x ==2 :
		print(x)
		break
	elif ((2** val) % val) == 2 :
		print (val)
		break
	else :
		continue

Submission status: Wrong Answer

Solution code:
x = int(input())

for val in range(x, x**100) :
	if ((2** val) % val) == 2 :
		print (val)
		break
	else :
		continue

Submission status: Wrong Answer

Solution code:
x = int(input())

for val in range(x, x**10) :
	if ((2** val) % val) == 2 :
		print (val)
		break
	else :
		continue

Submission status: Wrong Answer

Solution code:
x = int(input())

for val in range(x, x**5) :
	if ((2** val) % val) == 2 :
		print (val)
		break
	else :
		continue

Submission status: Wrong Answer

Solution code:
x = int(input())

for val in range(x, x**2) :
	if ((2** val) % val) == 2 :
		print (val)
		break
	else :
		continue