On a $(4 n+2) \times(4 n+2)$ square grid, a turtle can move between squares sharing a side. The turtle begins in a corner square of the grid and enters each square exactly once, ending in the square where she started. In terms of $n$, what is the largest positive integer $k$ such that there must be a row or column that the turtle has entered at least $k$ distinct times?
We shall prove that the answer is $2 n+2$. Number the rows in increasing order, from top to bottom, and number the columns from left to right. By symmetry, we may (and shall) assume that the turtle starts in the top right corner square.

First we shall prove that some row or column must be entered at least $2 n+2$ times. Let $m=4 n+2$. First note that each time the turtle moves, she enters either a row or a column. Let $r_{i}$ denote the number of times the turtle enters row $i$, and let $c_{i}$ be similarly defined for column $i$. Since the turtle moves $m^{2}$ times,

$$
r_{1}+r_{2}+\cdots+r_{m}+c_{1}+c_{2}+\cdots+c_{m}=m^{2}
$$

Now note that each time the turtle enters column 1, the next column she enters must be column 2. Therefore $c_{1}$ is equal to the number of times the turtle enters column 2 from column 1. Furthermore, the turtle must enter column 2 from column 3 at least once, which implies that $c_{2}>c_{1}$. Therefore since the $2 m$ terms $r_{i}$ and $c_{i}$ are not all equal, one must be strictly greater than $m^{2} /(2 m)=2 n+1$ and therefore at least $2 n+2$.

Now we construct an example to show that it is possible that no row or column is entered more than $2 n+2$ times. Partition the square grid into four $(2 n+1) \times(2 n+1)$ quadrants $A, B, C$, and $D$, containing the upper left, upper right, lower left, and lower right corners, respectively. The turtle begins at the top right corner square of $B$, moves one square down, and then moves left through the whole second row of $B$. She then moves one square down and moves right through the whole third row of $B$. She continues in this pattern, moving through each remaining row of $B$ in succession and moving one square down when each row is completed. Since $2 n+1$ is odd, the turtle ends at the bottom right corner of $B$. She then moves one square down into $D$ and through each column of $D$ in turn, moving one square to the left when each column is completed. She ends at the lower left corner of $D$ and moves left into $C$ and through the rows of $C$, moving one square up when each row is completed, ending in the upper left corner of $C$. She then enters $A$ and moves through the columns of $A$, moving one square right when each column is completed. This takes her to the upper right corner of $A$, whereupon she enters $B$ and moves right through the top row of $B$, which returns her to her starting point. Each row passing through $A$ and $B$ is entered at most $2 n+1$ times in $A$ and once in $B$, and thus at most $2 n+2$ times in total. Similarly, each row and column in the grid is entered at most $2 n+2$ times by this path. (See figure below.)

![](https://cdn.mathpix.com/cropped/2024_04_17_4e2fdc850b893ca2928fg-4.jpg?height=572&width=672&top_left_y=245&top_left_x=716)