Farmer John has a rectangular square grid. He labels the first row , the second row , and so on. He plants corn on any square of the form , for non-negative integers . Given that the unplanted squares form a contiguous region , find the perimeter of .
Problem 1331
Official solution
1. Understanding the Problem:
Farmer John has a rectangular grid. He plants corn on any square of the form for non-negative integers and . We need to find the perimeter of the contiguous region formed by the unplanted squares.
2. Expressibility:
A number is expressible if it can be written in the form for non-negative integers and . We need to determine which numbers are not expressible.
3. Chicken McNugget Theorem:
The Chicken McNugget theorem states that for two coprime integers and , the largest number that cannot be expressed as (where and are non-negative integers) is . Here, and , which are coprime.
Therefore, the largest number that cannot be expressed is:
4. Non-expressible Numbers:
All numbers from to that cannot be expressed as are unplanted. However, since we are dealing with a grid, we need to consider the numbers modulo and .
5. Column-wise Analysis:
We analyze the grid column-wise. Each column (where ) contains numbers of the form for . We need to determine when is expressible.
6. Modulo Condition:
Suppose is expressible. Then, there exist non-negative integers and such that:
Rearranging, we get:
This implies . Since , we have:
Therefore, .
7. Unplanted Squares in Each Column:
For each column , the number of unplanted squares is . We need to count the unplanted squares in each column and determine the perimeter of the contiguous region .
8. Perimeter Calculation:
The unplanted squares form 8 "staircases" connected edge-to-edge. Each staircase has a maximum height and width. The perimeter of each staircase is .
Summing up the perimeters of all staircases:
9. Overcounting Correction:
We overcount twice the edges where the staircases are connected. The total length of these edges is . Therefore, we subtract from the total perimeter.
Final perimeter:
The final answer is .