Start with a list of the double digit prime numbers for reference:
11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79, 83, 89, 97
For the smallest 9-digit number that follows the given rule, start with 1.
1
We then try 2 next to that and find that it works, since 12 isn't a prime number.
12
3 can't go next though, as we'd have 23, which is prime, so try 4...that works.
124
Keep working your way up to 9 digits, always trying to use the smallest remaining digits first. It doesn't take very long.
Use a similar strategy for the largest 9-digit number, starting with 9 and working down as you reference the list of primes.
When you've worked out your numbers, feel free to post and I'll let you know if that's what I got.
Rob used all the digits except 0 to write a 9-digit counting number such
that no two consecutive digits form a 2-digit prime number. (That is, for the
number abc,def,ghi, where letters stand for unique digits, none of the
following 2-digit numbers are prime: ab, bc, cd, de, ef, fg, gh, hi.) What is the positive difference between the largest and smallest such numbers that
Rob could write?
1 answer