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())
for i in range(X,10**6):
    flag = True
    for j in range(2,int(i**0.5+1)):
        if (i%j) == 0:
            flag = False
            print('F',i,j)
            break
    if flag:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(x,10**6):
    if i%2==0:
        continue
    cnt=0    
    for j in range(3,x+1,2):
        if i%j==0:
            cnt+=1
            break
    if cnt==0:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
import numpy as np

DEBUG = False

def dprint(*args):
    if DEBUG:
        print(*args)

num = int(input())

primes = []

for i in range(2, num+1, 2):
    if not primes:
        primes.append(i)
    else:
        candiv = False
        for prime in primes:
            if i % prime == 0:
                candiv = True
                break
        if not candiv:
            primes.append(i)

dprint(primes)

if primes[-1] == num:
    print(num)
    exit()

new_prime = num + 1

while(True):
    candiv = False
    for prime in primes:
        if new_prime % prime == 0:
            candiv = True
    if not candiv:
        print(new_prime)
        break
    else:
        new_prime += 1

Submission status: Wrong Answer

Solution code:
x = int(input())
while True:
    if x % 2 != 0:    
        for m in range(3,int(x**0.5)+4,2):
            if x % m == 0 and x > m:
                break
        else:
            break
    x += 1
print (x)

Submission status: Wrong Answer

Solution code:
x = int(input())
ps = set(range(x + 1, 2 * x + 1))
for i in range(2, x+1):
    for j in range(0, 3 * x, i):
        if j in ps:
            ps.remove(j)
print(min(ps))

Submission status: Wrong Answer

Solution code:
def P(n):#素数判定のアルゴリズム(O(√n))
    if type(n)!=int:raise TypeError#自然数以外はエラーを返す
    if n<1:raise ValueError#1未満は定義域を外れています
    if n==1:return -1#1は素数でも合成数でもないので負数を返す
    if n&1==0:return 2#高速化用に2を別で判定
    a=1
    while a*a<n:#nの平方根以下のすべての奇数で割れるか判定
        a+=2#奇数のみの判定なので偶数を飛ばせる
        if n%a==0:return a#割り切れたら最小の素因数を返す
    return 0#割れなかったら(素数なら)0を返す
import math
a=int(input())
while P(a)==0:a+=1
print(a)

Submission status: Wrong Answer

Solution code:
X = int(input())
X = X + 1
prime = None
while True:
    for i in range(2, X):
        if X % i == 0:
            break
    else:
        prime = X
    if prime != None:
        break
    else:
        X += 1

print(prime)

Submission status: Wrong Answer

Solution code:
def get_primenumber(N):
    prime_list = [2]
    for num in range(3,N+1,2):
      if all( num % prime != 0 for prime in prime_list):
        prime_list.append(num)

    return prime_list

n = int(input())
l = get_primenumber(n+400)
for i in l:
  if i > n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
def check(num):
    if num > 1:
        for i in range(2, num + 1):
            if (num % i) == 0:
                return False
                break
            else:
                return True
    else:
        return False


a = int(input())

for i in range(a, 100500):
    if check(i):
        print(i)
        break

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
if X == 2:
    print(2)
X = X-1
while X:
    X += 1
    for j in range(2,int(math.sqrt(X))+1):
        if X%j == 0:
            break
        elif j == int(math.sqrt(X)) and X%j != 0:
            print(X)
            exit()

Submission status: Wrong Answer

Solution code:
import sys
x = int(input())
i = 2
INF = 100001-x
while (i <= x):
    if (x%i == 0 and x != i):
        break
    if (x % i == 0 and x == i):
        print(x)
        sys.exit()
    i += 1

while (x <= INF):
    i = 2
    while(i <= x):
        if (i % 2 == 0):
            i += 1
            continue

        if (x % 2 == 0):
            x += 1
            continue

        if (x % i == 0 and x != i):
            x += 1
            break

        if (x % i == 0 and x == i):
            print(x)
            sys.exit()

        else:
            i += 2

    x += 1

Submission status: Wrong Answer

Solution code:
import math 
def isPrime(n): 
	if(n <= 1): 
		return False
	if(n <= 3): 
		return True
	if(n % 2 == 0 or n % 3 == 0): 
		return False
	for i in range(5,int(math.sqrt(n) + 1), 6): 
		if(n % i == 0 or n % (i + 2) == 0): 
			return False
	return True
def nextPrime(N): 
	if (N <= 1): 
		return 2
	prime = N 
	found = False
	while(not found): 
		prime = prime + 1
		if(isPrime(prime) == True): 
			found = True
	return prime 
try:
    N = int(input())
    if (N > 2 and N <= 100000):
        print(nextPrime(N)) 
    elif(N==2 and N<=100000):
        print(2)
    else:
        print("")
except:
    pass

Submission status: Wrong Answer

Solution code:
x=int(input())
import math
for i in range(x+1, 10**5+100000):
  flag=True
  e = math.floor(math.sqrt(x))
  for j in range(2, e+1):
    if i%j == 0:
      flag=False
      break
  if flag==True:
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
ps = set(range(x + 1, 2 * x + 1))
for i in range(2, x+1):
    for j in range(0, 2 * x + 1, i):
        if j in ps:
            ps.remove(j)
print(min(ps))

Submission status: Wrong Answer

Solution code:
import sys
import math

A = raw_input()
A = int(A)

primes = []

for i in xrange(100000):
    if i <= 1:
        continue
    if not primes:
        primes.append(i)
        continue
    for j in primes:
        #print i, j, primes
        if i % j == 0:
            break
        if math.sqrt(i) < j:
            primes.append(i)
            break
    else:
        primes.append(i)
for x in primes:
    if x < A:
        continue
    print x
    break

Submission status: Wrong Answer

Solution code:
x=int(input())
import math
for i in range(x+1, 10**5+1000):
  flag=True
  e = math.floor(math.sqrt(x))
  for j in range(2, e+1):
    if i%j == 0:
      flag=False
      break
  if flag==True:
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
def get_primenumber(N):
    prime_list = [2]
    for num in range(3,N+1,2):
      if all( num % prime != 0 for prime in prime_list):
        prime_list.append(num)

    return prime_list

n = int(input())
l = get_primenumber(n+200)
for i in l:
  if i > n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
from itertools import count

X = int(input())

pn = [2]
for L in count(3):
    chk = True
    for L2 in pn:
        if L % L2 == 0:
            break
    else:
        pn.append(L)
        if L >= X:
            print(L)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())
X = X + 1
prime = None
while True:
    for i in range(2, X):
        if X % i == 0:
            break
    else:
        prime = X
    if prime != None:
        break
    else:
        X += 1

print(X)

Submission status: Wrong Answer

Solution code:
import math 
def isPrime(n): 
	if(n <= 1): 
		return False
	if(n <= 3): 
		return True
	if(n % 2 == 0 or n % 3 == 0): 
		return False
	for i in range(5,int(math.sqrt(n) + 1), 6): 
		if(n % i == 0 or n % (i + 2) == 0): 
			return False
	return True
def nextPrime(N): 
	if (N <= 1): 
		return 2
	prime = N 
	found = False
	while(not found): 
		prime = prime + 1
		if(isPrime(prime) == True): 
			found = True
	return prime 
N = int(input())
if (N > 2 and N <= 100000):
    print(nextPrime(N)) 
elif(N==2 and N<=100000):
    print(2)
else:
    print("")

Submission status: Wrong Answer

Solution code:
import math 
def isPrime(n): 
	if(n <= 1): 
		return False
	if(n <= 3): 
		return True
	if(n % 2 == 0 or n % 3 == 0): 
		return False
	for i in range(5,int(math.sqrt(n) + 1), 6): 
		if(n % i == 0 or n % (i + 2) == 0): 
			return False
	return True
def nextPrime(N): 
	if (N <= 1): 
		return 2
	prime = N 
	found = False
	while(not found): 
		prime = prime + 1
		if(isPrime(prime) == True): 
			found = True
	return prime 
N = int(input())
if (N > 2 and N <= 100000):
    print(nextPrime(N)) 
elif(N==2 and N<=100000):
    print(2)

Submission status: Wrong Answer

Solution code:
x = int(input())

cad = x

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1
    
while True:
    cad += 1
    flag = is_prime(cad)
    if flag:
        print(cad)
        break

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

def sosuu(num):
  numsq = int(math.sqrt(num))
  judge = True
  for i in range(numsq):
    if (num % (i + 2) == 0):
      judge = False
      break
  return (judge)

while True:
  if (sosuu(N) == False):
    N+=1
  else:
    break;

print(N)

Submission status: Wrong Answer

Solution code:
def check(num):
    if num > 1:
        for i in range(2,num):
            if (num % i) == 0:
                return True           
            else:
                return False
    else:
        return True

x = int(input())
while check(x):
    x += 1
print(x)

Submission status: Wrong Answer

Solution code:
import sys
import math
X = int(sys.stdin.readline())

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

Submission status: Wrong Answer

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

def qprime(n):
    if n<2:return False
    elif n==2:return True
    elif n%2==0:return False
    for i in range(3,math.floor(math.sqrt(n))+1,2):
                   if n % i == 0:return False
    return True


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

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout

input = stdin.readline()[:-1].split(' ')

x = int(input[0])
n = 2
prime = 0

nums = set()

while prime <= x:
    is_prime = True
    for num in nums:
        is_prime = is_prime and (True if n % num != 0 else False)
    if is_prime:
        prime = n
        nums.add(n)
    n += 1

print('{}'.format(prime))

Submission status: Wrong Answer

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

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

a = primes(x*2)

b = [a[i] for i in range(len(a)) if a[i]>x]
print(min(b))

Submission status: Wrong Answer

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

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

print(a)

Submission status: Wrong Answer

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

if n == 2:
    print(2)
    sys.exit(0)
elif n <= 3:
    print(3)
    sys.exit(0)
elif n <= 5:
    print(5)
    sys.exit(0)
elif n <= 7:
    print(7)
    sys.exit(0)


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

new = n +  (6 - (n % 6))
while True:
    if new - 1 >= n:
        if is_prime(new - 1):
            print(new - 1)
            sys.exit(0)
    if is_prime(new + 1):
        print(new + 1)
        sys.exit(0)
    new += 6

Submission status: Wrong Answer

Solution code:
def isPrime(x):
  i = 2
  while i*i <= x:
    if x % i == 0:
      return True
  return False

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

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
if X == 2:
    print(2)
for i in range(X,10**8):
    for j in range(2,int(math.sqrt(i))+1):
        if i%j == 0:
            break
        elif j == int(math.sqrt(i)) and i%j != 0:
            print(i)
            exit()

Submission status: Wrong Answer

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

if n == 2:
    print(2)
    sys.exit(0)
elif n < 3:
    print(3)
    sys.exit(0)
elif n < 5:
    print(5)
    sys.exit(0)
elif n < 7:
    print(7)
    sys.exit(0)


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

new = n +  (6 - (n % 6))
while True:
    if new - 1 >= n:
        if is_prime(new - 1):
            print(new - 1)
            sys.exit(0)
    if is_prime(new + 1):
        print(new + 1)
        sys.exit(0)
    new += 6

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
x = int(input())
while True:
    if x % 2 != 0:    
        for m in range(3,int(x**0.5)+4,2):
            if x % m == 0:
                break
        else:
            break
    x += 1
print (x)

Submission status: Wrong Answer

Solution code:
n=int(input())
so=0
if n== 2:
  print(2)
  so=1
else:
  for i in range(2,n):
    if n%i==0:
      break
    so=1
    print(n)
    break

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

for j in range(0,1000):
  n+=2
  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)
  x=divisors
  t=len(x)
  if t==2 and so==0:
    print(x[1])
    break

Submission status: Wrong Answer

Solution code:
import math

n=int(input())

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

    if n == 2:
        return True

    if n % 2 == 0:
        return False

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

    return True


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

Submission status: Wrong Answer

Solution code:
x = int(input())

def is_prime(num):
  for i in range(2, num):
    if num % i == 0:
      return False

  return True

count_x = x

while count_x < 10**5:
  if is_prime(count_x)==True:
    print(count_x)
    break
  else:
    count_x += 1
    pass

Submission status: Wrong Answer

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

if n < 3:
    print(3)
    sys.exit(0)
elif n < 5:
    print(5)
    sys.exit(0)
elif n < 7:
    print(7)
    sys.exit(0)


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

new = n +  (6 - (n % 6))
while True:
    if new - 1 > n:
        if is_prime(new - 1):
            print(new - 1)
            sys.exit(0)
    if is_prime(new + 1):
        print(new + 1)
        sys.exit(0)
    new += 6

Submission status: Wrong Answer

Solution code:
X = int(input())
A = 0

if X == 2:
  print(2)

elif X == 3:
  print(3)
  
elif X % 2 == 0:
  X = X+1

for i in range(X,X+1000):
    for j in range(2,X//2):
      A = X % j
      if A == 0:
        X += 2
        break
print(X)

Submission status: Wrong Answer

Solution code:
x = int(input())

def is_prime(num):
  for i in range(2, num):
    if num % i == 0:
      return False

  return True

count_x = x

while count_x < 10**5:
  if is_prime(x)==True:
    print(count_x)
    break
  else:
    count_x += 1
    pass

Submission status: Wrong Answer

Solution code:
import numpy as np

number = int(input())

if number == 1:
	print(2)
elif number == 2:
    print(number)
else:
    first = 0
    for i in range(2, number):
        if number%i == 0:
            first = 1
            break
    if first == 0:
        print(number)
    else:
        for i in range(number + 1, 100000):
            flag = 0
            for j in range(2, i):
                if i % j == 0:
                    flag = 1
                    break
            if flag == 0:
                print(i)
                break

Submission status: Wrong Answer

Solution code:
import math 
def isPrime(n): 
	if(n <= 1): 
		return False
	if(n <= 3): 
		return True
	if(n % 2 == 0 or n % 3 == 0): 
		return False
	for i in range(5,int(math.sqrt(n) + 1), 6): 
		if(n % i == 0 or n % (i + 2) == 0): 
			return False
	return True
def nextPrime(N): 
	if (N <= 1): 
		return 2
	prime = N 
	found = False
	while(not found): 
		prime = prime + 1
		if(isPrime(prime) == True): 
			found = True
	return prime 
N = int(input())
if (N > 2):
    print(nextPrime(N)) 
elif(N==2):
    print(2)

Submission status: Wrong Answer

Solution code:
import sys
x = int(input())
i = 2
INF = 100001-x
while (i <= x):
    if (x%i == 0 and x != i):
        break
    if (x % i == 0 and x == i):
        print(i)
        sys.exit()

    if (i % 2 == 1):
        i += 2
    else:
        i += 1

while (x <= INF):
    i = max(2,x - 100)
    while(i <= x):
        if (x%2 == 0 ):
            x += 1
            continue
        if (x%i == 0 and x != i):
            x += 2
            break
        if (x % i == 0 and x == i):
            print(i)
            sys.exit()
        else:
            i += 1
    x += 2

Submission status: Wrong Answer

Solution code:
a = int(input())
while True:
    if (a % 2 != 0):
        for i in range(3, int(a ** 0.5 + 1), 2):
            if a % i == 0:
                a += 1
                break
        else:
                break
    else:
        a += 1
        continue
print(a)

Submission status: Wrong Answer

Solution code:
import math

X=int(input())
rt=int(math.sqrt(X))

def prime(A):
  pn=[2]
  for L in range(3,A+1):
    chk=True
    for L2 in pn:
        if L%L2 == 0:chk=False
    if chk==True:pn.append(L)
  return pn

pm_list=prime(rt)

if X in pm_list:
  print(X)
else:
  get_pri=False
  N=X+1
  
  while get_pri==False:
    judge=True
    for i in pm_list:
    
      if N%i==0:
        judge=False
        continue
    if judge==True:
      get_pri=True
      print(N)
    N+=1

Submission status: Wrong Answer

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


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

    # nの平方根まで計算する
    m = math.floor(math.sqrt(n)) + 1
    for p in range(3, m, 2):
        if n % p == 0:
            return False
    return True


for i in range(x+1, x+200):
    if isPrime(i):
        print(i)
        break
    else:
        continue

Submission status: Wrong Answer

Solution code:
import math
def isprime(limit):
    for k in range(limit, limit + 100000):
        if k % 2 == 0:
            continue
        for divisor in range(2, math.floor(math.sqrt(k)) + 2):
            if k % divisor == 0:
                break
            if divisor == int(math.floor(math.sqrt(k)) + 1):
                return k
num = int(input())
print(isprime(num))

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


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

    while True:
        if is_prime(X):
            print(X)
            break

        X += 1


main()

Submission status: Wrong Answer

Solution code:
import math

prime_numbers=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]
def isPrime(n):
    n=float(n)
    if n == 2:
        return True
    if n % 2 == 0:
        return False
  
    m = math.floor(math.sqrt(n))
    for p in prime_numbers:
        if n % p == 0:
            return False
        if p > m:
            break
    return True

x=int(input())
a3=False
while a3 == False:
    a3=isPrime(x)
    x+=1
print(int(x-1))

Submission status: Wrong Answer

Solution code:
x = int(input())
while True:
    if x % 2 != 0:    
        for m in list(range(3,int(x**0.5)+3,2)):
            if x % m == 0:
                break
        else:
            break
    x += 1
print (x)

Submission status: Wrong Answer

Solution code:
n=int(input())
so=0
if n== 2:
  print(2)
  so=1
else:
  for i in range(2,n):
    if n%i==0:
      break
    so=1
    print(n)
    break

if n%2==0:
  n+=1
for j in range(0,200):
  n+=2
  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)
  x=divisors
  t=len(x)
  if t==2 and so==0:
    print(x[1])
    break

Submission status: Wrong Answer

Solution code:
import sys
import math
X = int(sys.stdin.readline())

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
x = int(input())
i = 2
INF = 100001-x
while (i <= x):
    if (x%2 == 0):
        break
    if (x%i == 0 and x != i):
        break
    if (x % i == 0 and x == i):
        print(i)
        sys.exit()

    if (i % 2 == 1):
        i += 2
    else:
        i += 1

while (x <= INF):
    i = max(2,x - 100)
    while(i < x):
        if (x%2 == 0):
            x += 1
            continue
        if (x%i == 0 and x != i):
            break
        if (x % i == 0 and x == i):
            print(x)
            sys.exit()
        else:
            i += 1
    x += 2

Submission status: Wrong Answer

Solution code:
x = int(input())

primes = [2]

index = 3
while True:
    primeFlag = True
    for prime in primes:
        if index%prime==0:
            primeFlag = False
            break
    if primeFlag:
        primes.append(index)
        if index>=x :
            break
    index+=1
print(index)

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


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

    if X == 2:
        print(2)
        return
    elif X == 3:
        print(3)
        return

    while True:
        if is_prime(X):
            print(X)
            break

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


main()

Submission status: Wrong Answer

Solution code:
import math
A = int(input())
i = 0
S = 0
B = int(math.sqrt(A))
while i == 0:
    S = 0
    B = int(math.sqrt(A))
    for n in range(2,B + 1):
        if A % n == 0:
            print("A")
            A += 1
            S = 1
            break
    if S == 0:
        print(A)
        exit()

Submission status: Wrong Answer

Solution code:
import numpy as np

number = int(input())

if number == 2:
    print(number)
else:
    first = 0
    for i in range(2, number):
        if number%i == 0:
            first = 1
            break
    if first == 0:
        print(number)
    else:
        for i in range(number, 100000):
            flag = 0
            for j in range(2, i):
                if i % j == 0:
                    flag = 1
                    break
            if flag == 0:
                print(i)
                break

Submission status: Wrong Answer

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

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

print(a)

Submission status: Wrong Answer

Solution code:
import math

X=int(input())
rt=int(math.sqrt(X))

def prime(A):
  pn=[2]
  for L in range(3,A):
    chk=True
    for L2 in pn:
        if L%L2 == 0:chk=False
    if chk==True:pn.append(L)
  return pn

pm_list=prime(rt)

if X in pm_list:
  print(X)
else:
  get_pri=False
  N=X+1
  
  while get_pri==False:
    judge=True
    for i in pm_list:
    
      if N%i==0:
        judge=False
        continue
    if judge==True:
      get_pri=True
      print(N)
    N+=1

Submission status: Wrong Answer

Solution code:
import math
i=int(input())
j=math.sqrt(i)
k=0
m=i
while k==0:
  for l in range(2,i-1):
    if m%l!=0:
      k=1
      break
  m+=1  
m=m-1
print(str(m))

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

tmp = int(math.sqrt(x))

if x == 2:
    print(2)

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

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

        if count == 0:
            print(x)
            break

Submission status: Wrong Answer

Solution code:
N = int(input())
def sieve(n, s):
    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] and i > s]
print(sieve(N*2, N)[0])

Submission status: Wrong Answer

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


def get_primenumber(number):
    prime_list = []
    # 2からnumberまでの数字をsearch_listに入れる
    search_list = list(range(2, number+1))
    while True:
    # search_listの先頭の値が√nの値を超えたら処理終了
        if search_list[0] > math.sqrt(number):
            # prime_listにsearch_listを結合
            prime_list.extend(search_list)
            break
        else:
            # search_listの先頭をprime_listに入れる
            head_num = search_list[0]
            prime_list.append(head_num)
            # search_listの先頭をpopする
            search_list.pop(0)
            # head_numの倍数を取り除く
            search_list = [num for num in search_list if num % head_num != 0]
    return prime_list

prime_list = get_primenumber(100000)

left = 0
right = len(prime_list)-1

if X == 2:
    print(int(2))
elif X > 99991:
    print(int(100003))
else:
    while left <= right:
        mid = (left+right) // 2
        if prime_list[mid] == X:
            ans = prime_list[mid]
            break
        elif prime_list[mid] > X:
            if prime_list[mid-1] < X:
                ans = prime_list[mid]
                break
            else:
                right = mid - 1
        else:
            if prime_list[mid+1] > X:
                ans = prime_list[mid]
                break
            else:
                left = mid + 1

    print(int(ans))