As we all know, it's turtles all the way down. But is it primes all the way down too?
A number is considered a "turtle-prime" if it satisfies the following conditions:
1) It is prime.
2) It is possible to remove a single digit leaving a prime number.
3) Step 2 can be repeated until left with a single digit prime.
For example, 239
is a "turtle-prime", as it can be reduced to 23
then either 2
or 3
, both of which are prime. It also can be reduced to 29
then 2
. 151
is not a turtle prime, as it reduces to 15
(not prime), 51
(not prime), or 11
. 11
is prime, but can only reduce to 1
, which is not.
Given a positive integer, determine if it is a "turtle-prime". Your output can be in any form so long as it gives the same output for any truthy or falsey value.
Test cases:
input -> output
1 -> false
2 -> true
17 -> true
19 -> false
239 -> true
389 -> false
Scoring
This is code-golf, so the shortest answer in each language wins!