# DWITE Online Computer Programming Contest

## Primal Numbers

January 2011
Problem 2

Math sure likes its prime numbers, those with only two factors, 1 and itself. 2, 3, 5, 7 are the first four prime numbers, written in a consecutive sequence. We’ve made up a new sequence of numbers, primal numbers, that are based on the values of the prime numbers sequence.

The 1st primal number is the value that is in the position #(value of the 1st prime) in the prime sequence. That is, the 1st prime is 2, and the prime number in the 2nd position is 3, so the 1st primal number is 3.

The 2nd primal number is in position #(value of 2nd prime) in the prime sequence. The 2nd prime is 3 and the 3rd prime is 5, so the 2nd primal number is 5. The sequence continues in the same pattern; 3, 5, 11, 17 are the first four primal numbers.

The input file DATA2.txt will contain 5 lines, integers 1 ≤ N ≤ 1000.

The output file OUT2.txt will contain 5 lines, each being the Nth primal number.

Note: Think about performance for large values of N. The 1000th prime is 7919, so you’d need the 7919th prime to figure out what the 1000th primal number is.

Sample Input:
```4
24
8
1
15```
Sample Output:
```17
461
67
3
211```