This question will be a twist on finding the n
th prime number.
Challenge
You must write a program that will take one input n
, and output the n
th prime number whose decimal representation contains the decimal representation of n
as a subtring.
Confused? Here are some examples.
n=1
Primes: 2, 3, 5, 7, 11
^1 first prime that contains a 1
Output: 11
n=2
Primes: 2, 3, 5, 7, 11, 13, 17, 19, 23
^1 ^2 second prime that contains a 2
Output: 23
n=3
Primes: 2, 3, 5, 7, 11, 13, 17, 19, 23
^1 ^2 ^3 third prime that contains a 3
Output: 23
n=10
Primes: 2, 3, 5, 7, 11, ..., 97, 101, 103, 107, 109, ..., 997, 1009, 1013, 1019, 1021, 1031, 1033
^1 ^2 ^3 ^4 ^5 ^6 ^7 ^8 ^9 ^10 tenth prime that contains a 10
Output: 1033
This is code-golf, so lowest byte count wins.
If something is confusing, please leave a comment.
Hot Network Questions
list. \$\endgroup\$