The k-th prime
Write code · Challenge · §2.1 Primes
Complete the function solution, which returns the k-th smallest prime. The first prime is 2.
Function
solution(k)
Constraints
kis an integer from 1 to 1,000.
Examples
| k | result |
|---|---|
1 | 2 |
5 | 11 |
Starter code
def solution(k):
answer = 0
return answerSolve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.