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:
x = int(input())
while True:
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            x += 1
            break
        else:
            print(x)
            exit()

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

    for j in range(100000000000):
        ans = is_prime(n)
        if ans == True:
            print(n)
            break
        n += 1


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
x = int(input())
while not all(x % i for i in range(2, x)):
    x += 1

Submission status: Wrong Answer

Solution code:
X = int(input())

ans = X
while True:
    for i in range(2, ans):
        if ans % i == 0:
            ans += 1
            break
    print(ans)
    break

Submission status: Wrong Answer

Solution code:
X = int(input())


def prime(n):
    if n == 2:
        return True
    if n < 1:
        return False
    return pow(2, n - 1, n) == 1


ans = X
while True:
    if prime(ans) == True:
        print(ans)
        break
    else:
        ans += 1

Submission status: Wrong Answer

Solution code:
X = int(input())


def prime(n):
    if n == 2:
        return True
    if n < 1:
        return False
    return pow(2, n - 1, n) == 1


ans = X+1
while True:
    if prime(ans) == True:
        print(ans)
        break
    else:
        ans += 1

Submission status: Wrong Answer

Solution code:
import math

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

x = int(input())
for j in range(x,10**5 + 1):
    if prime_number(j) and x <= j:
        print(j)
        break

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

X = int(input())
Num = X+1

while any(Num%i==0 for i in range(2,Num)):
    Num += 1

print(Num)

Submission status: Wrong Answer

Solution code:
x = int(input())
prime = [2,3]
j = 3
while prime[-1] < 1000:
    j = j + 2
    i = 1
    pr = True
    while prime[i]*prime[i] <= j:
        if j % prime[i] == 0:
            pr = False
            break
        i = i+1
    if pr == True:
        prime.append(j)
        
newprime = 0
while newprime == 0:
    pr = True
    for i in range(len(prime)):
        if x %  prime[i] == 0:
            pr = False
            break
    if pr == True:
        newprime = x
    x = x+1
print(newprime)

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

primes = [2]

for n in range(3, 10000000000, 2):
    f = True
    mp = math.ceil(math.sqrt(n))
    for p in primes:
        if p > mp:
            break
        if n % p == 0:
            f = False
            break
    if f:
        primes.append(n)
        if n >= x:
            print(n)
            exit(0)

Submission status: Wrong Answer

Solution code:
def resolve():
    n = int(input())
    if n==2:
        print("2")
    for j in range(10000):
        flag = 1
        a = int((n+j)**0.5)+1
        for i in range(2, a+1):
            if (n+j) % i== 0:
                flag = -1
            if i == a and flag ==1:
                print(n+j)
                exit()
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    n = int(input())
    a = int(n**0.5)+1
    if n==2:
        print("2")
    for j in range(10000):
        flag = 1
        for i in range(2, a+1):
            if (n+j) % i == 0:
                flag = -1
            if i == a and flag ==1:
                print(n+j)
                exit()
resolve()

Submission status: Wrong Answer

Solution code:
n=int(input()) 
for i in range(10): 
	bool_1=True 
	for i in range(2,int(n**0.5//1)):   
		if n % i ==0:  
			bool_1=False 
			break     
	if bool_1:break 
	n+=1 
print(n)

Submission status: Wrong Answer

Solution code:
X = int(input())

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1
  
for i in range(X+1, 10 ** 7):
  if is_prime(i):
    print(i)
    break

Submission status: Wrong Answer

Solution code:
X = int(input())

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1
  
for i in range(X+1, 10 ** 6):
  if is_prime(i):
    print(i)
    break

Submission status: Wrong Answer

Solution code:
from math import sqrt

x = int(input()) - 1
pnums = []
if x >= 4:
    for i in range(2, int(sqrt(x))+1):
        for j in pnums:
            if i % j == 0:
                break
        else:    
            pnums.append(i)

while True:
    x += 1
    x_sqrt = sqrt(x)
    if x_sqrt.is_integer():
        pnums.append(x_sqrt)
        break
    
    for a in pnums:
        if x % a == 0:
            break
    else:
        print(x)
        break

Submission status: Wrong Answer

Solution code:
x=int(input())
if x==2:
  print(2)
  exit()

for i in range(x+1,x*100):
  for j in range(2,int(x**0.5)+2):
    if i%j==0:
      break
  else:
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
if x==2:
  print(2)
  exit()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

def is_sosuu(X):
  # 2以外の偶数は素数ではないので無視する
  if X % 2 == 0:
    return False
  
  # 繰り返しの上限を対象の平方根にする
  limit = int(math.sqrt(X)) + 1
  # ２の倍数を省く
  numbers = [i for i in range(3, limit) if i % 2 == 1]
  for i in numbers:
    if X % i == 0:
      return False

  return True

N = int(input())
while True:
  if is_sosuu(N):
    print(N)
    break
  N+=1

Submission status: Wrong Answer

Solution code:
X = int(input())

prime = [0] * (2 * X)

for i in range(2, 2 * X):
	if prime[i] == 0:
		for j in range(2, (2 * X) // i):
			prime[j * i] = 1
	else:
		continue

for i in range(X+1, 2 * X):
	if prime[i] == 0:
		print(i)
		break

Submission status: Wrong Answer

Solution code:
X= int(input())

#素因数分解。
pf={}
m=X
for j in range(0,1000):
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:pf[m]=1
    #print(pf)

    if (len(pf)==1) and (list(pf.values())[0]==1):
        #print(m)
        break
    else:
        m =m+1
        
print(m)

Submission status: Wrong Answer

Solution code:
X=int(input())
n = 200000
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)-1):
    if X==2:
        print("2")
    elif (primes[i]<X)and(X<=primes[i+1]):
        print(primes[i+1])

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

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

X = int(input())

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

print(X)

Submission status: Wrong Answer

Solution code:
X = int(input())


def make_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


while 1:
    if len(make_divisors(X)) == 2:
        break
    X += 1

Submission status: Wrong Answer

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

def isPrime(x:int):
    if x < 2 or x == 9:
        return False
    if x == 2:
        return True
    if x%2 == 0:
        return False
    for i in range(3,int(math.sqrt(x)),2):
        if x%i == 0:
            return False
    else:
        return True
      
for i in range(x,10000):
  if isPrime(i):
    print (i)
    exit (0)

Submission status: Wrong Answer

Solution code:
x = int(input())
prime = [2]
for n in range(3, int(x ** 0.5) + 1):
    flag = True
    for p in prime:
        if n % p == 0:
            flag = False
            continue
    if flag:
        prime.append(n)
res = x
if res in prime:
    print(res)
while not (res in prime):
    res += 1
    flag = True
    for p in prime:
        if res % p == 0:
            flag = False
            continue
    if flag:
        print(res)
        break

Submission status: Wrong Answer

Solution code:
x=int(input())
l=[2]
for i in range(3,round((2*x)**0.5)):
  for j in range(len(l)):
    if i%l[j]==0:
      break
    if j==len(l)-1:
      l.append(i)
def pri(x,l):
  for i in range(len(l)):
    if x%l[i]==0:
      return 0
    if i==len(l)-1:
      return 1

while pri(x,l)==0:
  x+=1
print(x)

Submission status: Wrong Answer

Solution code:
X = int(input())

def is_prime(n):
  for i in range(2,n):
    if n % i ==0:
      return False
    elif i**2 > n:
      return True

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

Submission status: Wrong Answer

Solution code:
import math
def main(X):
    max_search = min(101, (int(math.sqrt(X)+1) if math.sqrt(X) % 1 == 0 else math.ceil(math.sqrt(X))))
    if X <= 3:
        return X
    SosuuFlg = False
    while SosuuFlg == False:
        for i in range(2, max_search):
            if X % i == 0:
                break
        else:
            SosuuFlg = True
            return X
        X += 1
        
X = int(input())
print(main(X))

Submission status: Wrong Answer

Solution code:
import math
def main(X):
    if X <= 3:
        return X
    SosuuFlg = False
    while SosuuFlg == False:
        for i in range(2, 101):
            if X % i == 0:
                break
        else:
            SosuuFlg = True
            return X
        X += 1
        
X = int(input())
print(main(X))

Submission status: Wrong Answer

Solution code:
import math
def main(X):
    max_search = min(100,math.ceil(math.sqrt(X)))+1
    if X <= 3:
        return X
    SosuuFlg = False
    while SosuuFlg == False:
        for i in range(2, max_search):
            if X % i == 0:
                break
        else:
            SosuuFlg = True
            return X
        X += 1
        
X = int(input())
print(main(X))

Submission status: Wrong Answer

Solution code:
import math
def main(X):
    max_search = min(100,math.ceil(math.sqrt(X)))
    if X <= 3:
        return X
    SosuuFlg = False
    while SosuuFlg == False:
        for i in range(2, max_search):
            if X % i == 0:
                break
        else:
            SosuuFlg = True
            return X
        X += 1
        
X = int(input())
print(main(X))

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = 0

for _ in range(10**5):
    x += 1

    for i in range(2, int(x**0.5) + 1):
        if (x % i) == 0:
            break
        elif i == int(x**0.5):
            ans = x
        else:
            pass

    if ans != 0:
        print(ans)
        break

Submission status: Wrong Answer

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('c1.in')


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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    X = read_int()
    n = 10 ** 5
    for i in range(X, n):
      is_prime = True     
      for d in range(2, X):
          if i % d == 0:
            is_prime = False
      if is_prime:
        print(i)
        break


main()

Submission status: Wrong Answer

Solution code:
x = int(input())
rx = int(x**(1/2)) + 1
P = [2] + [2*i+1 for i in range(1, rx//2)]
while True:
    flag = True
    for i in P:
        if x % i == 0:
            flag = False
            break
    if flag:
        print(x)
        break
    P.append(int(x**(1/2))+2)
    x += 1

Submission status: Wrong Answer

Solution code:
x = int(input())
rx = int(x**(1/2)) + 1
P = [2] + [2*i+1 for i in range(1, rx//2)]
while True:
    flag = True
    for i in P:
        if x % i == 0:
            flag = False
            break
    if flag:
        print(x)
        break
    x += 1

Submission status: Wrong Answer

Solution code:
from math import sqrt, floor

# x = int(input())
x = 99992


def is_prime(x: int) -> bool:
    if x <= 1:
        return False

    for i in range(2, floor(sqrt(x))):
        if x % i == 0:
            return False

    return True


while not is_prime(x):
    x += 1

print(x)

Submission status: Wrong Answer

Solution code:
import math
s=int(input())
if s!=2 and s%2==0:
    s+=1
def prime(x):
  if x==2:
    return True
  else:
    for i in range(3,int(math.sqrt(s))+1,2):
      if s%i==0:
        return False
      else:
        return True

while True:
  if prime(s):
    print(s)
    break
  s+=2

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())

while True:
    if n != 2 and n % 2 != 0:
        for i in range(3, int(n**0.5+1),2):
            if n % i == 0:
                break
        else:
            print(n)
            sys.exit()

    n = n + 1

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())

while True:
    if n % 2 != 0:
        for i in range(3, int(n**0.5+1),2):
            if n % i == 0:
                break
        else:
            print(n)
            sys.exit()

    n = n + 1

Submission status: Wrong Answer

Solution code:
X = int(input())

while True:
    for p in range(2, X):
        if X % p == 0:
            break
        elif p == X - 1:
            print(X)
            exit()
    X += 1

Submission status: Wrong Answer

Solution code:
X = int(input()) + 1

while True:
    for p in range(2, X):
        if X % p == 0:
            break
        elif p == X - 1:
            print(X)
            exit()
    X += 1

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


x = int(input())

min_prime = 2

for i in range(x, 100000):
    if is_prime(i) is True:
        min_prime = i
        break

print(min_prime)

Submission status: Wrong Answer

Solution code:
import math

X = int(input())

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

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

    return True

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

Submission status: Wrong Answer

Solution code:
X=int(input())

if X==2:
  print(2)
else:
  while 1:
    flag=0
    for i in range(2,X):
      if X%i==0:
        flag=1
        break

    if flag==0:
      break
    else:
      X=X+1

print(X)

Submission status: Wrong Answer

Solution code:
x=int(input())
p=[2]

def isprime(n):
  for i in range(len(p)):
    if n%p[i]==0:
      return(0)
    elif i==len(p)-1:
      return(1)
                 
for i in range(3,x):
  if isprime(i)==1:
    p.append(i)

while isprime(x)==0:
  x+=1

print(x)

Submission status: Wrong Answer

Solution code:
X=int(input())
b=X**0.5
if all(X%i!=0 for i in range(2,int(b)+1)):
  X+=1
else:
  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())
print(nextPrime(N))

Submission status: Wrong Answer

Solution code:
import math
t = int(input())
if t<2:
    print(2)
    exit()
for i in range(t,t+50):
    v = int(math.sqrt(i))
    f=0
    for j in range(2,v+1):
        if i%j==0:
            f=1
            break
    if(f==0):
        print(i)
        break

Submission status: Wrong Answer

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

for i in range(t,t+50):
    v = int(math.sqrt(i))
    f=0
    for j in range(2,v+1):
        if i%j==0:
            f=1
            break
    if(f==0):
        print(i)
        break

Submission status: Wrong Answer

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

for i in range(t,t+20):
    v = int(math.sqrt(i))
    f=0
    for j in range(2,v+1):
        if i%j==0:
            f=1
            break
    if(f==0):
        print(i)
        break

Submission status: Wrong Answer

Solution code:
x = int(input())
if x == 1 or 2:
    print(2)
    quit()


primes = [2]
i = 3
while True:
    isDivisible = False
    for prime in primes:
        if i % prime == 0:
            isDivisible = True
    if not isDivisible:
        primes.append(i)
        if i >= x:
            break
    i+=2

print(primes[-1])

Submission status: Wrong Answer

Solution code:
x = int(input())
if x == 1:
    print(2)
    quit()
primes = [2]
i = 3
while True:
    isDivisible = False
    for prime in primes:
        if i % prime == 0:
            isDivisible = True
    if not isDivisible:
        primes.append(i)
        if i >= x:
            break
    i+=2

print(primes[-1])

Submission status: Wrong Answer

Solution code:
x = int(input())
primes = [2]
i = 3
while True:
    isDivisible = False
    for prime in primes:
        if i % prime == 0:
            isDivisible = True
    if not isDivisible:
        primes.append(i)
        if i >= x:
            break
    i+=2

print(primes[-1])

Submission status: Wrong Answer

Solution code:
x = int(input())
primes = []
i = 2
while True:
    isDivisible = False
    for prime in primes:
        if i % prime == 0:
            isDivisible = True
    if not isDivisible:
        primes.append(i)
        if i > x:
            break
    i+=1

print(primes[-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if n == 8 or n ==9:
  print(11)
  i = 0
elif n == 2 or n== 3 or n == 5 or n == 7:
  print(n)
  i = 0
elif n <= 6 and n%2 == 0:
  print(n+1)
  i = 0

while i > 0 :
  j = 3
  js = int(math.sqrt(i))
  while j <= js:
    if  i%j == 0:
      break
    elif j == js or j == js-1:
      print(i)
      i = -2
      break
    else:
      if j%2 == 0:
        j += 1
      else:
        j += 2
  if i%2 == 0:
    i += 1
  else:
    i += 2

Submission status: Wrong Answer

Solution code:
X=int(input())
p=0
for i in range (0,10000):
    if p!=0:
        break
    for j in range (2,X//2):
        if (X+i)%j==0:
            break
        if j==X//2-1:
            p=X+i
print(p)

Submission status: Wrong Answer

Solution code:
X = int(input())
def sosu(n):
  for i in range(2,n//2 + 1):
    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:
X = int(input())
l = list(range(2, 10**5))
for i in l:
    l = list(filter(lambda x: not x % i == 0, l))
    if l[0] >= X: break
print(l[0])

Submission status: Wrong Answer

Solution code:
import math

def check(x):
    if x <= 1:
        return 0
    k = int(math.sqrt(x))
    for i in range(2, k+1):
        if x % i == 0:
            return 0
    return 1

n = int(input())
n += 1
while check(n) == 0:
    n += 1
print(n)

Submission status: Wrong Answer

Solution code:
import math


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


X = int(input())

while not is_prime(X):
    X += 1

print(X)

Submission status: Wrong Answer

Solution code:
import math


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


X = int(input())

while not is_prime(X):
    X += 1

print(X)

Submission status: Wrong Answer

Solution code:
X = int(input())

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

Submission status: Wrong Answer

Solution code:
x = int(input())

#def prime number discriminator
def prime_or_not(a):
  b = 0
  for i in range(a):
    if a % (i + 1)== 0:
      b += 1
    else:
      pass
    if b >= 1:
      return 1
    else:
      return 0

ans = 0

while ans <1:
  ans += prime_or_not(x)
  x += 1
print(x - 1)

Submission status: Wrong Answer

Solution code:
x = int(input())

#√nまでの素数の配列を返す関数
def primes(n):
    pri = [2]
    k = 3
    while k*k <= n:
        for i in pri:
            if k%i == 0:
                break
            elif i == pri[-1]:
                pri.append(k)
        k += 2
    return pri
    
prime = primes(x)
x = (x//2)*2 + 1

while True:
    flag = True
    for i in prime:
        if x%i == 0:
            x += 2
            flag = False
            break
    if flag:
        break

print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())

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

print(X)

Submission status: Wrong Answer

Solution code:
import numpy as np
def prime():
    a = np.ones(100000)
    t = []
    for i in range(2,100000):
        if a[i] == 0:
            continue
        t.append(i)
        j=i+i
        while j < 100000:
            a[j] = 0
            j = j + i

    for i in range(int(input()),100000):
        if i in t:
            print(i)
            break

prime()

Submission status: Wrong Answer

Solution code:
import numpy as np
def prime():
    a = np.ones(100000)
    t = []
    for i in range(2,100000):
        if a[i] == 0:
            continue
        t.append(i)
        j=i
        while j < 100000:
            a[j] = 0
            j = j + i

    for i in range(int(input()),100000):
        if i in t:
            print(i)
            break

prime()

Submission status: Wrong Answer

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

    i = 2
    while True:
        if i ** 2 >= n:
            return True
        if n % i == 0:
            return False
        i += 1

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

Submission status: Wrong Answer

Solution code:
def primecheck2(x,primes):
    for i in primes:
        if x % i == 0:
            return False
            break 
    return True


x = int(input())
primes =[2]
for i in range(2,10**5):
    if primecheck2(i,primes):
        primes.append(i)
        if i >= x:
            break
print(max(primes))

Submission status: Wrong Answer

Solution code:
ans = int(input())

ok = 1

while ok:
    for i in range(2,ans+1):
        if ans % i == 0:
            ok = 0
    if ok == 0:
        print(ans)
    else:
        ans+=1

Submission status: Wrong Answer

Solution code:
x=int(input())
so=[2]
num=2

while True:
    num+=1
    judge=True
    for i in so:
        if num%i==0:
            judge=False
    if judge==True:
        so.append(num)
        if num>=x:
            break
print(num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X = INT()

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

for i in range(X+1, mod):
	flag = 0
	if i % 2 == 0:
		continue
	elif i % 3 == 0:
		continue
	else:
		for j in range(5, int(sqrt(i)) + 1):
			if i % j == 0:
				flag = 1
				break
		if flag == 0:
			print(i)
			exit()

Submission status: Wrong Answer

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

inf = 100000
for i in range(X+1,inf):
	if is_prime(i) == True:
		print(i)
		break

Submission status: Wrong Answer

Solution code:
n=int(input())
if n == 2:
    print(n)
for p in range(2, 100000):
    if n % p != 0:
        print(n)
        break

    else:
       n=n+1

Submission status: Wrong Answer

Solution code:
n=int(input())
for p in range(2, 10000):
    if n % p != 0:
        print(n)
        break
    else:
       n=n+1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = 0
while True:
    c = 2
    while True:
        
        if x % c == 0:
            break
        if c > (x//2) :
            ans = x
            break
        c += 1

    if ans != 0:
        break
    x += 1
print(x)

Submission status: Wrong Answer

Solution code:
from bisect import bisect_left

def get_prime_list(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())
primes = get_prime_list(100100)
print(bisect_left(primes, X))

Submission status: Wrong Answer

Solution code:
x=int(input())
if(x%2==0):
    a=x/2
else:
    a=x//2+1
y=2*a+1
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(y)):
        break
    y=y+2
if x==2:
    y = 2
print(str(int(y)))

Submission status: Wrong Answer

Solution code:
x=int(input())
if(x%2==0):
    a=x/2
else:
    a=x//2+1
y=2*a+1
import math
def is_prime(n):
    for i in range(3,int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True
while(True):
    if(is_prime(y)):
        break
    y=y+2
if x==2:
    y = 2
print(str(int(y)))

Submission status: Wrong Answer

Solution code:
import sys
import math
input = sys.stdin.readline

def multiples(n, x):
    for i in range(3,x):
        yield i*n
        if i*n > x:
            break

def sosuu(x):
    if x == 2 : return 2
    d = set()
    end = math.ceil(math.sqrt(x))
    d = d.union(multiples(2, x))
    for i in range(3,end,2):
        if i not in d:
            d = d.union(set(multiples(i, x)))
    
    i = x if x % 2 != 0 else x+1
    while True:
        if i not in d:
            return i
        i += 2

def main():
    x = int(input())
    print(sosuu(x))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
import math
input = sys.stdin.readline

def multiples(n, x):
    for i in range(3,x):
        yield i*n
        if i*n > x:
            break

def sosuu(x):
    if x == 2 : return 2
    d = set()
    end = math.floor(math.sqrt(x))
    d = d.union(set(multiples(2, x)))
    for i in range(3,end,2):
        if i not in d:
            d = d.union(set(multiples(i, x)))
    
    i = x if x % 2 != 0 else x+1
    while True:
        if i not in d:
            return i
        i += 2

def main():
    x = int(input())
    print(sosuu(x))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print ("fuck you ATCODER")

Submission status: Wrong Answer

Solution code:
import math

def IsP(n):
    s = int(math.ceil(math.sqrt(x)))
    if n == 1:
        return 0
    for i in range(2,s+1):
        if(n%i == 0):
            return 0
    return 1

x = int(input())

while(IsP(x)==0):
    x +=1
print(x)

Submission status: Wrong Answer

Solution code:
import math

def IsP(n):
    s = int(math.ceil(math.sqrt(x)))
    for i in range(2,s+1):
        if(n%i == 0):
            return 0
    return 1

x = int(input())

while(IsP(x)==0):
    x +=1
print(x)

Submission status: Wrong Answer

Solution code:
import math

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

n = int(input())

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

Submission status: Wrong Answer

Solution code:
import math

x = int(input()) + 1
ans = -1

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


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

print(x)

Submission status: Wrong Answer

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


def isprime(n):
    if n % 2 == 0:
        return False
    i = 3
    while i < math.sqrt(n)+1:
        if n % i == 0:
            return False
        i += 2

    return True


def calc(x):
    while not isprime(x):
        x += 1
    return x


print(calc(X))