If we have an infinite grid, and we color each cell, how many colors do we need so that a $m \times n$ rectangle always covers at most 1 of each color no matter how it is placed? (Rotation of the rectangle is allowed.)
It must be at least $mn$, but it seems $mn$ is not always enough.
Know results:
- For $m \times 1$, the answer is $m$.
- For $m \times m$ it is $m^2$.
Here is data from a computer program. Note that my program only considers periodic colorings with fundamental region the same area as the number of colors. So it is possible that colorings with less colors are possible if they are not arranged in this way.
The table below shows $k - mn$, where $k$ is the number of colors needed. The pattern seems obvious now (although a proof is still needed).
A few conjectures:
- For all cases in the table, if $mn$ is not enough, then it looks like $mn + m$ is for $m < n$. (False. turns out this is not true; $6 \times 4$ seems to require 32 colors. I updated the table above.)
- From my constructions it looks like $mn$ may be sufficient once $m$ is large enough for fixed $n$ (and vice versa). This is consistent with how rectangular tilings work. (Seems False.)
- From Gregory J. Puleo's comment: If $m$ divides $n$, it is plausible that $mn$ is enough. (If $m$ divides $n$, we can consider the rectangle a bar of larger squares, so by combining 1. and 2. from above we may be able to prove this.) (True. See his answer.)
- For $m \times (m + 1)$, the program finds colorings using $m(m + 2)$ colors. The fundemental region can be described by a parallelogram with two adjacent sides $(m(m + 2), 0)$ and $(m + 1, 1)$. These squares are marked yellow in the first table. Edit: In fact, for rectangles represented by a white cell it seems that for $m \times (m + k)$ we need $m(m + 2k)$ colors.
- It looks like for $m \times n$ where $n = jm, jm - 1, jm - 2, \cdots, \lfloor\frac{m + 2}{2}\rfloor$ and all $j$, we need $jm^2$ colors. These squares are marked green in the first table.
Does anyone know in general how many colors we need?
Background While trying to find all the fault-free tilings of the P-pentomino, I noticed that we can prove that the P-pentomino does not tile any $5 \times n$ rectangle for odd $n$, because such a rectangle does not fit $n$ $2 \times 2$ squares, and therefor can also not fit $n$ P-pentominoes. This made me wonder how close we can generally come to tiling a rectangle with an arbitrary given rectangle.
In general, rectangles pack and tile in complicated ways, so a direct analysis seems too hard. (For example, we can fit 4 $2 \times 3$ rectangles in a $5 \times 5$ rectangle in a pinwheel tiling construction.) Then I though of extending this technique to find how many rectangles will fit. But that only works if we need $mn$ colors for a $m \times n$ rectangle... and when I discovered this is not always the case, I wondered what is the general rule.










I haven't quite fleshed out exactly how to use this, but I think the following idea should probably enough to at least prove that $mn$ colors suffice if and only if $m$ divides $n$: if two squares lie in the same row or the same column and are exactly $n$ squares apart on that row or column, then they must both have the same color. Note that since no intervening squares on that row or column can also have the same color, this means that every row and every column is basically colored periodically, with period $n$. So I think a coloring with $mn$ colors is fully specified by its values on an $n \times n$ square.
Proof: Assume that $m < n$ and suppose we have a coloring using $mn$ colors, and consider an $(m+1)$ by $(n+1)$ rectangle, as shown below:
Let's say the color in the top-left corner is purple. All the colors the leftmost $n$ columns of the top row will be called "shades of red", and all the colors in the top $m$ columns of the left column will be called "shades of blue", indicated by the light shading in the diagram. Purple is both a shade of red and a shade of blue.
When we move down to row $m+1$, the only colors available for the leftmost $n$ columns are shades of red. Furthermore, as $m < n$, the leftmost square in row $m+1$ cannot be purple, as this would cause a vertical rectangle with the same upper-left corner to have two purple squares. With only the shades of red available for that row, purple must appear somewhere else among the leftmost $n$ columns in row $m+1$.
On the other hand, in column $n+1$ we can only use shades of blue, among which there must be a purple square. If the circled square does not use the color purple, then the lower-right $(m \times n)$ rectangle has two purple squares. Hence the circled square must be purple. Thus two squares at distance $n$ along the same row must have the same color. Repeating the argument with rows and columns interchanged shows that two square at distance $n$ along a column have the same color.
Edit: I think I now see how this implies that if $mn$ colors suffice, then $m$ divides $n$. Suppose that $m$ does not divide $n$, but we have an $mn$-coloring. This $mn$-coloring is determined by its values on an $n \times n$ square. Let $C_i$ be the set of colors used on the $i$th row of this square. We see that $C_1, \ldots, C_m$ are pairwise disjoint (these rows all being contained within an $m \times n$ rectangle), and that $C_i = C_{m+i}$ for all $i < n-m$, since $C_{m+i}$ must be disjoint from $C_{i+1}, \ldots, C_{m+i-1}$, leaving only the $n$ colors in $C_i$ available. (Row $m+i$ and row $i$ might have these colors in a different order, but they will be the same set of colors.)
If $m$ divided $n$, then we'd get each of the sets $C_1, \ldots, C_m$ appearing exactly $n/m$ times on the square. However, since $m$ doesn't divide $n$, this repeating pattern of sets gets "cut off" at the bottom, and $C_1$ appears on some row $C_{n-i}$ for $i < m$. Now a horizontal rectangle starting at row $n-i$ will contain two rows colored using colors from $C_1$ once the square repeats, contradicting the hypothesis that this is a proper coloring.