# When the product of any two consecutive digits in the number is a prime number

I came across a question today.

The number of 10-digit numbers such that the product of any two consecutive digits in the number is a prime number, is?

As much as I know the product of any two consecutive digits is a prime number only when one of them is $1$ and the other is a prime number (unless I am missing something). But I still can't see any way forward. So, how to do this?

EDIT: The answer to this problem is

2048

• I think you're off to a good start. So basically, every other number has to be 1. The other digits have to be 2,3,5, or 7. Consider numbers of the form 1x1x1x1x1x, where x = 2,3,5, or 7. Then, consider numbers of the form x1x1x1x1x1. EDIT: I just realized that 1 is not a prime number, so the "x" here cannot be 1. – nukeguy Feb 29 '16 at 20:04
• Is this good enough? 2121212121 – Moti Feb 29 '16 at 20:11

• And the same with the x's and $1$s reversed. – joriki Feb 29 '16 at 20:16
• Thought this would help you, but it did not! So here it is: $2^{11}$ – Moti Feb 29 '16 at 20:21
• but why is it $2^{11}$ – manshu Feb 29 '16 at 20:22
• For each x you have 4 possible selections (2, 3, 5, 7) - you multiply 4, 5 times ( for the 5 slots) - $4^5=2^{10}$. And than by 2 - see jorki comment. – Moti Feb 29 '16 at 20:25