$N$ is a 9-digit number which contains all the digits 1 to 9.

Any two adjacent digits in the number--in that order--form an integer which is divisible by either 6 or 7.

What is $N?$

The answer is 721849635.

**
This section requires Javascript.
**

You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.

We may first list all the possible 2-digit sequence, with cancellation of numbers containing '0' or repeated digits (repeated numbers are cancelled as well):

$12, 18, 24, \cancel{30}, 36, 42, 48, 54, \cancel{60}, \cancel{66}, 72, 78, 84, \cancel{90}, 96$

$\cancel{12}, 21, 28$ , $\fbox{35}$ , $\cancel{42}$ , $\fbox{49}$ , 56, $\fbox{63}$ , $\cancel{70}, \cancel{77}, \cancel{84}, 91, 98.$

From the list, we know that

(i) '7' must be the first digit,

(ii) the sequence $35, 49, 63$ must be selected;

(iii) from (ii), $\fbox{635}$ form a 'block' of the 9-digit number.

If '5' is not the last digit, by (iii), the block $\fbox{635}$ will be extended to $\fbox{6354}$ (as we cant choose 56). This follows by the block $\fbox{63549}$ . Since by (i), 6 is not the first digit of the number, there must be a digit in front of digit 6. Note that there are only three such possibilities, namely 3, 5 and 9. However we can't use any of these because of the block $\fbox{63549}$ . Hence '5' must be the last digit.

Using the previous argument, the block $\fbox{635}$ will be extended to $\fbox{49635}$ . Now we left with the digits 1, 2, 7 and 8. The previous list is now become

$12, 18, 24, \cancel{30}, \cancel{36}, \cancel{42}, \cancel{48}, \cancel{54}, \cancel{60}, \cancel{66}, 72, 78, 84, \cancel{90}$ , $\fbox{96}$

$\cancel{12}, 21, 28$ , $\fbox{35}$ , $\cancel{42}$ , $\fbox{49}$ , $\cancel{56}$ , $\fbox{63}$ , $\cancel{70}, \cancel{77}, \cancel{84}, \cancel{91}, \cancel{98}.$

By (i), the number is either $72**\fbox{49635}$ or $78**\fbox{49635}$ . It is clear that $78**\fbox{49635}$ is impossible, as there is no connection between the digits 8 and 4. So the only possibility is $\fbox{721849635}$ .