def is_prime(n):
"""Check if a number is a prime number."""
if n <= 1:
return False
if n <= 3:
return True
if n % 2 == 0 or n % 3 == 0:
return False
i = 5
while i * i <= n:
if n % i == 0 or n % (i + 2) == 0:
return False
i += 6
return True
def sum_of_primes_below(limit):
"""Calculate the sum of all prime numbers below a given limit."""
return sum(n for n in range(2, limit) if is_prime(n))
def nth_prime_below(limit, n):
"""Find the nth prime number below a given limit."""
primes = [num for num in range(2, limit) if is_prime(num)]
return primes[n-1] if n <= len(primes) else None
# Calculate the sum of prime numbers under 1000
sum_primes = sum_of_primes_below(1000)
# Find the 10th prime number under 1000
tenth_prime = nth_prime_below(1000, 10)
sum_primes, tenth_prime
ZGVmIGlzX3ByaW1lKG4pOgogICAgIiIiQ2hlY2sgaWYgYSBudW1iZXIgaXMgYSBwcmltZSBudW1iZXIuIiIiCiAgICBpZiBuIDw9IDE6CiAgICAgICAgcmV0dXJuIEZhbHNlCiAgICBpZiBuIDw9IDM6CiAgICAgICAgcmV0dXJuIFRydWUKICAgIGlmIG4gJSAyID09IDAgb3IgbiAlIDMgPT0gMDoKICAgICAgICByZXR1cm4gRmFsc2UKICAgIGkgPSA1CiAgICB3aGlsZSBpICogaSA8PSBuOgogICAgICAgIGlmIG4gJSBpID09IDAgb3IgbiAlIChpICsgMikgPT0gMDoKICAgICAgICAgICAgcmV0dXJuIEZhbHNlCiAgICAgICAgaSArPSA2CiAgICByZXR1cm4gVHJ1ZQoKZGVmIHN1bV9vZl9wcmltZXNfYmVsb3cobGltaXQpOgogICAgIiIiQ2FsY3VsYXRlIHRoZSBzdW0gb2YgYWxsIHByaW1lIG51bWJlcnMgYmVsb3cgYSBnaXZlbiBsaW1pdC4iIiIKICAgIHJldHVybiBzdW0obiBmb3IgbiBpbiByYW5nZSgyLCBsaW1pdCkgaWYgaXNfcHJpbWUobikpCgpkZWYgbnRoX3ByaW1lX2JlbG93KGxpbWl0LCBuKToKICAgICIiIkZpbmQgdGhlIG50aCBwcmltZSBudW1iZXIgYmVsb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