My (supposed) Problem of the Year

5 6 7 4 1 8 3 2 9 \begin{array}{|c|c|c|} \hline \ \ 5\ \ &\ \ 6\ \ &\ \ 7\ \ \\ \hline \ \ 4\ \ &\ \ 1\ \ &\ \ 8\ \ \\ \hline \ \ 3\ \ &\ \ 2\ \ &\ \ 9\ \ \\ \hline \end{array}

How many ways can we arrange the integers 1 through 9 in a 3 × 3 3\times3 grid such that any two adjacent entries are coprime? One such instance is shown above.


Details and Assumptions:

  • Two entries are adjacent if they share a common edge.
  • Two numbers a a and b b are coprime if gcd ( a , b ) = 1 \text{gcd}(a,b) = 1 .


The answer is 2016.

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

Mark Hennings
Apr 15, 2017

The number 6 6 cannot be adjacent to any of 2 , 4 , 8 , 3 , 9 2,4,8,3,9 , and so cannot be on the central square. There are two cases to consider:

If 6 6 is on an edge square, then there are three squares (shaded yellow) adjacent to it, which must be occupied by 1 , 5 , 7 1,5,7 . The other five squares must be filled by the other numbers. Since the three even numbers 2 , 4 , 8 2,4,8 cannot be adjacent to each other, and the two multiples of 3 3 cannot be adjacent to each other, there is essentially only one way of arranging the even numbers (marked E E ) and the multiples of 3 3 (marked T T ) successfully. Thus there are 4 × 6 × 2 × 6 = 288 4 \times6 \times 2 \times 6 = 288 arrangements of this type (four choices of square for 6 6 , six ways to arrange the even numbers, two ways to arrange the multiples of 3 3 , and six ways to arrange the other numbers).

If 6 6 is on a corner square, then the two squares adjacent to it must be occupied by two out of 1 , 5 , 7 1,5,7 . There are six choices for which additional square to fill with the third of these numbers. For each of these choices, there is exactly one way of arranging the evens and the multiples of three. Thus, for each of these choices, there are 4 × 6 × 2 × 6 = 288 4 \times 6 \times 2 \times 6 = 288 arrangements of that type.

Thus the total number of arrangements is 7 × 288 = 2016 7 \times 288 = \boxed{2016} .

Man, for the corner case I didn't realize that the prime or 1 could go anywhere of 6 spaces, pretty disappointed.

brian allen - 4 years ago
Efren Medallo
Apr 14, 2017

The big restriction in this problem is that we cannot place together the even numbers, and the multiples of 3 3 .

Taking this into consideration, we can boil it down to 3 cases:

Case (I) is placing the even numbers on the even numbered cells (i.e., the ones in the lighter shade of blue), and then placing the odd ones on the remaining cells;

Case (II) is placing the even numbers plus one of either 3 3 or 9 9 , on the odd-numbered cells, and then placing the rest on the remaining cells;

and Case (III) is placing the even numbers plus one from { 1 , 5 , 7 } \{1, 5, 7\} on the odd-numbered cells, then placing the rest on the remaining cells.

For case (I), by FPC, there are 4 ! = 24 4!=24 ways to arrange the even numbers on their respective places. To place the 3 3 and 9 9 such that they won't be anywhere adjacent to 6 6 , there will be 2 2 ways. Then, there will be 3 ! = 6 3! =6 ways to arrange the remaining 3 numbers. All in all, as these are independent events, there will be 24 × 2 × 6 = 288 24 \times 2 \times 6 = 288 possible arrangements following case (I).

We move on to case (II). Since only either 3 3 or 9 9 shall be grouped together with 6 6 on the odd-numbered cells, 6 6 cannot automatically be in the center as one of either 3 3 or 9 9 shall be on the even-numbered cells, which are adjacent to the center cell. Thus there are 4 4 ways for 6 6 to be placed on the odd-numbered cells. Then there are 2 2 ways in selecting which among 3 3 or 9 9 shall be placed on the odd-numbered cells, and then from which it has 2 2 ways to be placed such that it is on the same column or row as the 6 6 (If you place them on different rows/columns, then the remaining multiple of 3 shall have no place). Then, for each of the remaining odd and even numbers, there are 3 ! = 6 3!=6 ways each. Thus, for case (II), we have 4 × 2 × 2 × 6 × 6 = 576 4 \times 2 \times 2 \times 6 \times 6 = 576 ways.

For case (III), again we have 4 4 ways for 6 6 to be placed, for the same reason as above. Then we have 3 3 ways of selecting among { 1 , 5 , 7 } \{1, 5, 7\} . Now, this, together with the 3 remaining even numbers shall have 4 ! = 24 4!=24 ways to be arranged in the remaining odd-numbered cells. Now, we'll just have to make sure that 3 3 and 9 9 aren't adjacent to 6 6 . There are 2 2 ways to do that. And with the remaining two odd numbers there are obviously 2 2 ways to place them on the grid. Thus we have 4 × 3 × 24 × 2 × 2 = 1152 4 \times 3 \times 24 \times 2 \times 2 = 1152 ways for that.

And there you have it! 288 + 576 + 1152 = 2016 288 + 576 + 1152 = \boxed{2016} ! Ugh, too bad I'm a year late in posting this problem. Haha

Nice combinatorics problem. Enjoyed solving it. Thanks for posting the problem.

Indraneel Mukhopadhyaya - 4 years, 1 month ago

Wow, I'm amazed at the number of variants from that problem of making the integers coprime / not coprime.

Calvin Lin Staff - 4 years, 1 month ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...