Problem:
In an square grid, squares are marked so that every rectangle composed of exactly grid squares contains at least one marked square. Determine all possible values of .
Problem:
In an square grid, squares are marked so that every rectangle composed of exactly grid squares contains at least one marked square. Determine all possible values of .
Solution:
In this solution, we will reference cells by row and column, measured from left to right and top to bottom. The cell at is then in the top-left corner; the cell at is in the fourth cell of the second row.
For , we can mark the sole cell.
For , where is a prime, we need only ensure that each and rectangle contains a mark. This is the same as ensuring that all rows and columns contain a mark, which can be done, for example, by marking all cells for integers .
For , there must be a mark in each row and column and also in each rectangle. To achieve this, we can mark all cells of the form , for integers . An illustration for follows:

Note that there are exactly such cells, and that row contains a cell in the column
Likewise, there is a marked cell in each column. Now, we will show that all rectangles contain a marked cell. Consider the rectangle with upper-left corner at for integers . Then, if contains the cell
and otherwise it contains the cell
Since , this cell is always a valid marked cell. This concludes the proof that the construction is correct.
Now, we prove that no other values of are satisfiable. First, we again note that every row and column must have exactly one marked cell, as there are of each and they are disjoint. Let for and partition the grid into a grid of rectangles. In particular, let be the rectangle that has upper-left corner at and lower-right corner at for . Then each must contain exactly one marked cell, since there are also of them and they are disjoint.
Consider the set of rectangles . There are exactly marked cells among these rectangles - one in each of the columns from to , and also one in each of the rectangles . Therefore, there is some permutation of the integers so that has a marked cell in column . Now, we will prove the claim that if a rectangle contains a marked cell in column of the grid, . We prove this by induction on , having already demonstrated the case . Suppose the claim holds for some ; we will show it must also hold for . Consider satisfying . We know that the unique marked cell in rectangle is in column . Therefore, must contain a mark in column , as otherwise the rectangle with top-left corner at has no mark. Next, consider satisfying . The unique marked cell in rectangle is in column . Also, the rectangle cannot contain a marked cell in column , since there is already a mark in that column. So must contain a marked cell in column , as otherwise the rectangle with upper-left corner at has no mark. Proceeding in order of increasing in this way forces the claim to hold for as well, completing the inductive proof.
Likewise, there is a permutation of the integers so that, if contains a marked cell in row of the grid, .
We will now show that either and are both increasing or both decreasing. Suppose not, so that for some and (or the same with swapped, which is handled identically). Then, consider the rectangles , and . An example for follows:

Taking an rectangle with upper-left corner directly below the marked cell in , we find that it lies entirely inside these four rectangles and yet does not contain any of their marked cells. In particular, we can note that, since is increasing at this point, the horizontal distance between the marks in the lower left and upper right is strictly greater than . Also, since is decreasing at this point, the vertical distance between the marks in the top left and lower right is strictly greater than . This means that an rectangle with no mark exists, a contradiction. Therefore, either is increasing or is decreasing.
Suppose, without loss of generality, that both are increasing (noting that the increasing and decreasing cases are simply rotations of each other). Then the marked cell in row must be . But if is divisible by two distinct primes or the cube of a prime, there is no unique value for , which is a contradiction. Therefore, must be , a prime, or the square of a prime.