Superprimes are prime numbers that occupy prime numbered positions in the sequence of prime numbers.
Consider the sequence of the first 7 prime numbers: 2, 3 , 5 , 7, 11 , 13, 17 . The numbers in bold are superprimes, because they occupy positions 2, 3, 5, and 7 in the sequence.
3 is the first superprime. What are the last 3 digits of the 142nd superprime?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The 142nd superprime is 6311, and the last 3 digits are 311 .
Write a function that determines whether an integer is prime. Then, iterate through the integers to check if they are prime, and if their position amongst the primes is prime.