Reseto
The sieve of Eratosthenes is a famous algorithm to find all prime numbers up to N. The algorithm is:
1. Write down all integers between 2 and N, inclusive.
2. Find the smallest number not already crossed out and call it P; P is prime.
3. Cross out P and all its multiples that aren't already crossed out.
4. If not all numbers have been crossed out, go to step 2.
Write a program that, given N and K, find the K'th integer to be crossed out.
InputThe integers N and K (2 ≤ K < N ≤ 1000).
OutputOutput the K'th number to be crossed out.
Input
7 3 Output
6Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.