Problem 57810. List the two-bit primes
Each year at Christmas, my father-in-law and his partner send me the Puzzle Mania section from the New York Times. This year’s edition had a puzzle by Mike Shenk called “Two Bits”, which asked solvers to find words whose first two letters could be shifted as a unit elsewhere in the word to form a new word. For example, the clue “??BID” had the answer RABID, with the accompanying word BRAID. The clue “??PREME” had the answer SUPREME, with the accompanying word PRESUME.
In a similar way, one can define two-bit primes: prime numbers whose first two digits can be shifted, as a unit, elsewhere in the number to form a new prime number. The first in the sequence is 113, with accompanying prime 311, followed by 131, with accompanying prime 113. Some two-bit primes can have multiple accompanying primes. For example, the two-bit prime 99611 has two accompanying primes: 69911 and 61991. Leading zeros are allowed: 1103 is a two-bit prime because 311 is also prime.
Remember that the two-bit prime and its accompanying prime must differ. For example, the first two digits of 99991 can be moved one or two places to the right, but the resulting number (99991) is the same. Because 99199 is not prime, 99991 is not a two-bit prime.
Write a function to list the nth two-bit and all its accompanying primes.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers7
Suggested Problems
-
1224 Solvers
-
108 Solvers
-
Area of an equilateral triangle
6195 Solvers
-
Can the given sides form a triangle?
117 Solvers
-
64 Solvers
More from this Author280
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!