# Painting a 6x6 with 3 colours

Can you paint a 6x6 grid in red, green and blue, such that its every 3x3 sub-grid contains exactly 5 red, 3 green and 1 blue cell?

Good luck!

Will this work?

$$r r r r r r$$
$$r b r r b r$$
$$g g g g g g$$
$$r r r r r r$$
$$r b r r b r$$
$$g g g g g g$$

• You've go it! In fact there is a simple algorithm that can find solutions for arbitrary grid sizes, number of colors and their counts. – Dmitry Kamenetsky Oct 1 '19 at 0:47
• @DmitryKamenetsky, nice! Thanks. – ppgdev Oct 1 '19 at 0:52

Yes. (I can paint it in such a way)

Reasoning

There are at least $$9!/3!5!=504$$ different arrangements that work
My method of producing them is to take any 3 x 3 grid that satisfies the condition, and tile it into a 6 x 6 grid.
This works because any 3 x 3 sub-grid of a 6 x 6 always contains the same cells of the original 3 x 3 grid.

There are possible arrangements that are not tilings like these, but I have not looked for them.

Here is an example of a non-tiling (horizontally anyway) that follows the rules.

• I doubt that "There are possible arrangements that are not [repeated, identical] tilings like these", because proof-by-contradiction says if there is any non-identicality, it would be possible to pick some subgrid with at least 1 more of at least one color, hence 1 less of at least another color. – smci Apr 23 at 19:41
• WLOG, why not put the blue cell at top-left? – smci Apr 23 at 19:42
• @smci you can replace the last column to be any order of repeating RGB without breaking the rule, hence demonstrating a non-repeating pattern – Matthew Jensen Apr 26 at 3:11
• but how would that not be an identical tiling? Can you show it in your answer? – smci Apr 26 at 3:54
• I can add a picture or several tomorrow. Starting with a repeating 3x3 pattern you can rearrange any row, as long as the row itself still repeats. This will break the vertical repetition while following the rules. You can do the same with columns. – Matthew Jensen Apr 26 at 4:02