#K79407. K-th Prime Number
K-th Prime Number
K-th Prime Number
Given an integer k, your task is to output the k-th smallest prime number. Let \(P_n\) denote the n-th prime number. That is, for a valid input k (with \(k \ge 1\) and \(k\) not exceeding the total number of primes precomputed up to \(10^6\)), you should print \(P_k\). If k is not valid, output None
.
Note: Primes are computed using the sieve of Eratosthenes up to \(10^6\). Use standard input/output for reading the input and writing the output.
inputFormat
The input consists of a single integer k
provided via standard input.
outputFormat
If k
is valid, output the k-th smallest prime number to standard output. Otherwise, output None
(without quotes).
1
2