Find all positive integers for which it is possible to color some cells of an infinite grid of unit squares red, such that each rectangle consisting of exactly cells (and whose edges lie along the lines of the grid) contains an odd number of red cells.
Solution
Proof. This can be achieved as follows: assuming the cells are labeled with , color a cell red if and . For example, a rectangle gets the following coloring:

A rectangle contains every possible pair exactly once, so such a rectangle will contain one red cell (an odd number).
On the other hand, consider a rectangle with . The set of cells this covers is where covers a range of size and covers a range of size . The number of red cells is the count of with multiplied by the count of with . The former number is exactly because divides (while the latter is 0 or 1) so the number of red cells is even. The case is similar.
Finally, given these colorings, we can add them up modulo 2, i.e. a cell will be colored red if it is red in an odd number of these colorings. We illustrate as an example; the coloring is 4-periodic in both axes so we only show one cell.

This solves the problem.
Alternate proof of (ii) using generating functions
We will commit to constructing a coloring which is -periodic in both directions. (This is actually forced, so it's natural to do so.) With that in mind, let
denote its generating function, where .
For this to be valid, we need that for any rectangle with area , the sum of the coefficients of over it should be one, modulo . In other words, whenever , we must have
taken modulo . The idea is to rewrite these expressions: because we're in characteristic 2, the given assertion is , and the requested property is
Whenever , we must have
works. The end.