Find the prime number closest to the given integer .
[THOUGHT] We need to find the prime number closest to . We can start by checking if is prime. Then we check the numbers around . We can start by checking if is divisible by small primes like 2, 3, 5, 7, 11, etc. If it is not divisible by these small primes we can try larger ones. Alternatively, we can use a primality test like the Miller-Rabin test to check if is prime. Since we are looking for a prime close to N, it's likely that is not prime. We can check numbers slightly larger and smaller than N for primality.
[PYTHON] import math
def is_prime(n): if n <= 1: return False for i in range(2, int(math.sqrt(n)) + 1): if n % i == 0: return False return True
def find_closest_prime(n): if is_prime(n): return n
lower = n - 1
upper = n + 1
while True:
if is_prime(lower):
return lower
if is_prime(upper):
return upper
lower -= 1
upper += 1
print(find_closest_prime(12269117))
[THOUGHT] The Python code returned 12269137.
\boxed{12269137}