memememehh194
Giới thiệu
def find_nth_number(n):
from math import sqrt, ceil
def is_prime(num):
if num <= 1:
return False
for i in range(2, int(sqrt(num)) + 1):
if num % i == 0:
return False
return True
def find_largest_prime(n):
for i in range(int(sqrt(n)), 1, -1):
if is_prime(i):
return i
largest_prime = find_largest_prime(n)
count = [0] * (largest_prime + 1)
total_count = 0
i = 2
while total_count < n:
count[i] += i
total_count += count[i]
i += 1
while total_count > n:
i -= 1
total_count -= count[i]
return i * (n - total_count + count[i])
n = int(input())
result = find_nth_number(n)
print(result)