Problem:
 Score: 300 points    Problem Statement  Find the minimum prime number greater than or equal to X .      Notes  A prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.  For example, 2 , 3 , and 5 are prime numbers, while 4 and 6 are not.      Constraints   2 \le X \le 10^5  All values in input are integers.         Input  Input is given from Standard Input in the following format:  X       Output  Print the minimum prime number greater than or equal to X .        Sample Input 1 20      Sample Output 1 23  The minimum prime number greater than or equal to 20 is 23 .       Sample Input 2 2      Sample Output 2 2  X itself can be a prime number.       Sample Input 3 99992      Sample Output 3 100003

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

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

p = sieve(10**6)

for i in range(x, 10**6):
    if p[i]: print(i); exit()

Solution (Python):
import math

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

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

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

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def eratosthenes_sieve(n):
    """ 素数列挙(エラトステネスの篩) """

    table = [0] * (n + 1)
    prime_list = []
    for i in range(2, n + 1):
        if table[i] == 0:
            prime_list.append(i)
            for j in range(i + i, n + 1, i):
                table[j] = 1
    return prime_list

X = INT()

primes = sorted(eratosthenes_sieve(2 * 10**5))

for prime in primes:
    if prime >= X:
        print(prime)
        exit()

Solution (Python):
X = int(input())
def eratosthenes(N):
  s = [i % 2 for i in range(N)]
  s[0] = s[1] = 0
  s[2] = 1

  for i in range(2, int(N**0.5)):
    if s[i] == 0: continue
    for j in range(2 * i, N, i):
      s[j] = 0
  
  return s

s = eratosthenes(10**5 + 10)
for i in range(X, 10**5+10):
  if s[i] == 1:
    print(i)
    break

Solution (Python):
def get_primes(n: int) -> list:
    sieve=[1]*n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i] = [0] * ((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

X=int(input())
D=10**5+4
L=get_primes(D)
import bisect

print(L[bisect.bisect_left(L,X)])

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

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

for i in range(x,10**9):
    if is_prime(i):
        print(i)
        break

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


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

for i in range(X,X+1000000):
  if(is_prime(i) == True): 
    ans = i
    break
print(ans)

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

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

while not is_prime(X):
    X += 1

print(X)

Solution (Python):
import math

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

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

    return True
    
x = int(input())
while True:
    tf = is_prime(x)
    if tf:
        break
    else:
        x += 1
    
    
print(x)

Solution (Python):

def prime_sieve(N):
    if N < 2:
        return []
    search_list = list(range(2, N + 1))
    prime_list = []
    while search_list[0] <= N ** 0.5:
        prime_list.append(search_list[0])
        tmp = search_list[0]
        search_list = [i for i in search_list if i % tmp != 0]
    prime_list.extend(search_list)
    return prime_list


A = prime_sieve(100005)
X = int(input())
for p in A:
    if p >= X:
        print(p)
        break

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

def f(n):
    import math
    ans = True
    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i == 0:
            ans = False
    return ans

for i in range(x, 10**9):
    if f(i):
        print(i)
        break

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



for i in range(X, 150000):
        flag = True
        for j in range(2, int(i ** (1/2)) + 1):
                if i % j == 0:
                        flag = False
                        break
        if flag:
                print(i)
                exit()

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

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

for i in range(N,N+10**5):
    if(is_prime(i)):
        print(i)
        exit()

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

def prime(c):
    import math
    if c == 1:
        return False
    for i in range(2, round(math.sqrt(c)) + 1):
        if c % i == 0:
            return False
        else:
            continue
    return True

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

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

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

Solution (Python):

n = int(input())
import math

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

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

    return True

for i in range(n, 99999999999999999999999):
  if is_prime(i):
    if i >= n:
      print(i)
      exit()

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

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

y = primes(10**5*2)

from bisect import bisect_left
print(y[bisect_left(y,x)])

Solution (Python):
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:
    if is_prime(X):
        print(X)
        exit()
    X += 1