Rectangle Paths

A 2 × 13 2 \times 13 rectangle is divided into unit squares. You must write the numbers 1 through 26 26 into these unit squares, and satisfy the following criteria.

1) Each number is in a different square.

2) The number 1 must be in a corner.

3) The numbers i i and i + 1 i+1 must share an edge (of a unit square), for 1 i 25 1 \leq i \leq 25 .

How many different ways can you write the numbers into the squares?


The answer is 52.

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.

6 solutions

Logan Dymond
May 20, 2014

Of course, the first thing we want to do is draw a diagram. Reading the introduction, we can model the problem using an empty grid with 2 rows, 13 columns, and 12 vertical dividers between the columns.

The first condition suggests that each of the numbers will be in one and only one box, and each box with be filled with one and only one number. The third condition suggests that consecutive numbers must reside in adjacent boxes, either vertically or horizontally. The second condition suggests that the first number we place will be a 1 in any of the four corners.

Since the initial placement of the 1 does not affect the other conditions and we have both vertical and horizontal symmetry in the diagram, we can place the one in any of the corners, count the possibilities for that case, and multiply by a factor of 4 to account for each initial placement.

Assuming we place the 1 in the top left corner, we then have two possibilities to place the 2: the vertically adjacent box or the horizontally adjacent box. If we place the 2 in the vertically adjacent box (the box below the 1), we essentially "fill" the first column and have only slot open for the 3; the box to the right of the 2. At this point, we are faced with a similar choice for the 4: either the vertically adjacent box or the horizontally adjacent box. If, instead, at the beginning we place the 2 to the right of the 1, we will have left the first column "unfilled". At this point, the only way to fit all of the numbers in the grid given the conditions is to cross the rest of the vertical dividers leaving columns "unfilled" until we get to the last column, at which point we can turn around and fill the unfilled columns. In fact, as soon as we first cross a vertical divider leaving the previous column "unfilled," the positions of the rest of the numbers will be determined.

We have 12 opportunities to cross a different divider and one case in which we don't leave any columns unfilled, for a total of 13 configurations per corner. Since we want to consider all corners, we multiply 13 x 4 for a total of 52 configurations.

Once you loop, you don't have space to snake.

Calvin Lin Staff - 7 years ago

Log in to reply

God!! I read it as i and i+1 must not share an edge!

Pranjal Jain - 6 years, 8 months ago
Trever Reeh
May 20, 2014

In the game of Snake, you try to eat apples to increase the size of your snake. You try to avoid walls and hitting yourself, but when your snake is too large then you must get him to wrap around himself. This is the premise for how I thought about the problem.

Since 1 had to be started in the first corner, if you went the long way down and back it constituted as one. Knowing this and changing your mind half way you would never get back to the other side of the game.

Knowing this 2 can only go in one place to fill the first column to look different than the first. You go all the way down and back and that would be the 2nd answer.

When placing the 3rd and doing the same, you get the same as the first. So I moved on to the 4th, and did the same.

Knowing this all of the odd ones wouldn't work because they would look the same as the even ones. When you have worked out all of them you should get 13 different solutions to one corner.

Figuring that you couldn't have rotations or reflections being the same, they would be the same thing in the different corners and multiplied 13 by 4.

Which equals 52.

Steve Gregg
May 20, 2014

The 1 can be in any of the four corners. By symmetry, the rectangle can be filled in the same number of ways, starting from each of the four corners. So we can count the number with the 1 in a given corner, and multiply that answer by 4 to get the final result. I'll put the 1 in the lower left corner of the 2x13 rectangle.

Now let f(n) = the number of ways of filling the rest of the numbers in a 2xn rectangle, for odd n. Clearly f(1)=1. We now compute f(n), for odd n>1.

One way to fill in the rest of the numbers is to put 2 to the right of 1. In that case, the only way to finish is to proceed along the bottom row all the way to the end of the grid, then go up one square, then go all the way back to the left along the top row.

If we put the 2 above the 1, there are two ways to proceed. One way is to put 3 to the right of 2, 4 to the right of 3, and then go all the way to the end along the top row, go down one square, and then back to the left along the bottom row.

Or, starting from 1, put 2 above the 1, 3 to the right of 2, 4 below the 3, and 5 to the right of 4. But the number of ways to finish filling the grid from here is f(n-2), since the 5 can be considered to be in the lower left corner of a 2 x (n-2) rectangle.

Putting all of this together, we conclude that f(n) = 2 + f(n-2). Working out the recursion a step at a time starting from f(1)=1, we get f(13) = 13. So as described in the first paragraph, the final answer is 13 * 4 = 52.

Damiann Mangan
May 20, 2014

WLOG, 1 1 is on top-left by the properties it is symmetrical. From here on, we could divide the case into big two:

1) 2 2 is on 1 1 's left. 3 3 have to be on 2 2 's left, else there's no room for 3 3 's successor to complete the rectangle and the third constraint. That gives us 1 way to make the rectangle.

1) 2 2 is below 1 1 . 3 3 have to be on 2 2 's left as its only choice. Finally, 3 3 and 4 4 will have similar case and properties with 1 1 and 2 2 . Which means it will gives us recursive case until we ends up at 23 23 and 24 24 .

Thus, 1 1 on top-left gives us 13 13 ways to complete the rectangle. Ultimately, we have 52 = 4 13 52 = 4 \cdot 13 by having 1 1 at other three optional corner.

Calvin Lin Staff
May 13, 2014

Let us assume that the rectangle has 13 13 squares left to right and 2 2 squares top to bottom, and let us write the number 1 in the lower left corner. By symmetry, the total number of solutions will be 4 times the number of solutions with 1 in this corner. From this starting position, we can either put 2 above 1, or we can put 2 to the right on 1.

If we put 2 to the right of 1, we cannot place 3 above 2, since we could then only place numbers to the left or to the right of this, and would not get all the numbers. After we place 3 to the right of 2, we again have the same issue with placing 4. Thus, we must keep placing numbers along the bottom until we get to the 13 13 in the last position, and then write 14 , , 26 14, \ldots, 26 reversed in the top row.

If we had put 2 above 1, we then see that 3 must be placed to the right of 2. We are now forced to make a symmetric decision about where to place 4. Placing to the right will force the rest of the numbers, and placing it below will give us the symmetric same choice for 6.

We see that we can arrange the numbers by going up and down on the first k k columns, and then go all the way to the end in the same row starting with the k + 1 th k+1^{\mbox{th}} column. If we go up and down 12 12 columns, then the last column is forced, so this is the same as going up and down all 13 13 columns. Thus, we can choose any number from 0 0 to 12 12 for k k , so there are 13 13 ways that we can do this.

Since we had 4 possible positions for the 1 to start in, there are 52 52 ways that the numbers can be written.

How the rule works

1 x x x x x x x x x x x x
x x x x x x x x x x x x x

You can either go zigzag (change direction) or straight forward.

Zigzag

1 C x x x x x x x x x x x
A B x x x x x x x x x x x

Straight forward

1 x x x x x x x x x x x x
A B C D . . . . . . . . .

If we go forward like this,

1 2 x x x x x x x x x x x
x x x x x x x x x x x x x

you must go forward till the end.

Because if you go zigzag after forward like this,

1 2 x x x x x x x x x x x
x 3 x x x x x x x x x x x

you'll separate into 2 rooms, which can't be filled together.

In the beginning, you can start the zigzag and then straight any time, as long as straight must be the last step. For this example, straight starts at 10 -> 11.

1 4 5 8  9 26 25 24 23 22 21 20 19
2 3 6 7 10 11 12 13 14 15 16 17 18

However, not every positions can do the straight. For this example, when we do straight at 3, it'll be the same as doing the straight at 2, because 2 is forced to go at only 1 direction.

1 x x x x x x x x x x x x
2 3 x x x x x x x x x x x

Here're the positions repetition occurs when you do straight, labelled "O".

1 x O x O x O x O x O x O
x O x O x O x O x O x O x

There are 13 x's (i.e. 13 different ways to do this).

1 1 can stay in any 4 corners, so there are 13 × 4 = 52 13\times 4 = \boxed{52} ways.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...