A 9-digit number

N 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 ? 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.

2 solutions

Chan Lye Lee
Oct 23, 2017

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 , 30 , 36 , 42 , 48 , 54 , 60 , 66 , 72 , 78 , 84 , 90 , 96 12, 18, 24, \cancel{30}, 36, 42, 48, 54, \cancel{60}, \cancel{66}, 72, 78, 84, \cancel{90}, 96

12 , 21 , 28 \cancel{12}, 21, 28 , 35 \fbox{35} , 42 \cancel{42} , 49 \fbox{49} , 56, 63 \fbox{63} , 70 , 77 , 84 , 91 , 98. \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 35, 49, 63 must be selected;

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

If '5' is not the last digit, by (iii), the block 635 \fbox{635} will be extended to 6354 \fbox{6354} (as we cant choose 56). This follows by the block 63549 \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 63549 \fbox{63549} . Hence '5' must be the last digit.

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

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

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

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

There's a much easier representation using graph theory. Set up the vertices as numbers, and draw a directed edge between 2 numbers if you can concatenate them.

Then, we want to find a directed path through all vertices, which becomes obvious.

Calvin Lin Staff - 3 years, 7 months ago

Log in to reply

@Calvin Lin I am aware of the method, but when there are too many edges, the similar case (in my posted method) have to consider again.

Chan Lye Lee - 3 years, 7 months ago

Log in to reply

Ah. The graph theory representation made it easier for me to see what was happening as I deleted edges. Let me present my approach.

Calvin Lin Staff - 3 years, 7 months ago
Calvin Lin Staff
Nov 7, 2017

We start by creating a directed graph where numbers are the vertices, and a directed edge means we can concatenate the 2 numbers. The goal is to find an eulerian path that goes through all of these vertices.

This is what the graph looks like. The bolded edges indicate that we can travel both ways.

  • Vertex 7 has an in-degree of 0. Hence, it must start the sequence. Henceforth, if a vertex has an in-degree of 1, then that edge must exist.
  • Vertex 5 has an in-degree of 1. Hence, we must have edge 35.
  • Vertex 3 has an in-degree of 1. Hence we must have edge 63. Now, edge 56 is useless, so let's delete it.
  • Vertex 6 has an in-degree of 1. Hence we must have edge 96. Now, edge 91 is useless, so let's delete it
  • Vertex 9 has an in-degree of 1. Hence we must have edge 49. Now, edge 54, 42 is useless, so let's delete it.
  • Vertex 5 has an out-degree of 0. This tells us that it's the last digit. Henceforth, if a vertex has an out-degree of 1, then that edge must exist.

This is what the graph looks like now, with the vertices shifted and edges deleted. The blue edges indicate the ones that we must have.

Let's continue (Use the above graph to visualize what happens):

  • Vertex 8 has an out-degree of 1. Hence we must have edge 84. Now, edge 14, 48, 42 is useless, so let's delete it.
  • Vertex 1 has an in-degree of 1. Hence we must have edge 21. Now, edge 28 is useless, so let's delete it.
  • Vertex 2 has an in-degree of 1. Hence we must have edge 72. Now, edge 78 is useless, so let's delete it.
  • Vertex 1 has an out-degree of 1. Hence we must have edge 18.

Thus, the number is 721849635.

@Chan Lye Lee What I wanted to point out is that the sequence of steps is "immediate" by selecting the only possible steps. There is no trial and error / figuring out what works.

It was somewhat surprising that this logical sequence resulted, so I felt it was worthwhile to showcase.

Calvin Lin Staff - 3 years, 7 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...