# Painting a grid with 3 colours such that there are no right-angled triangles of one colour

What is the largest rectangular NxM grid (by area) that can be painted with 3 colours, such that no three cells of the same colour form a right-angled triangle. N and M must be 4 or greater. We only consider right-angled triangles whose legs are parallel to the grid's edges. For example the following is not allowed:

x.....x
.......
x......


while the following is allowed

...x...
.......
x.....x


Here is a similar question: Painting a 10x10 grid with 3 colours

Good luck!

• admins can you please close this question. It doesn't work. – Dmitry Kamenetsky Jan 4 '20 at 12:22
• You can hit the delete button yourself, if you think the puzzle isn't worth solving. – Bass Jan 4 '20 at 17:59
• Delete doesn't work, because it already has answers. – Dmitry Kamenetsky Jan 4 '20 at 23:06

Previous answer, valid before alteration to question.

The maximum area is

trivially infinite

if one

simply creates a rectangle three units high and any number of units across (giving it an arbitrarily large area) and fills the first row with red, the second with blue, and the third with yellow.

Note that

any three-in-a-row of the same colour does not count as a triangle (refer to the valid solution of the linked question, which contains many such occurrences).

• You can actually make the rectangle three times as wide. rot13(Bar ebj bs rnpu pbybhe.) – Jaap Scherphuis Jan 4 '20 at 12:01
• @JaapScherphuis Indeed, I guess the score is now rot13(gevcyr vasvavgl.) – ZanyG Jan 4 '20 at 12:02
• @DmitryKamenetsky Then refer to Jaap's suggestion three comments above this one. I will edit my answer as such. – ZanyG Jan 4 '20 at 12:14
• @DmitryKamenetsky I think it is also pretty easy to show 4x4 is not possible. – Jaap Scherphuis Jan 4 '20 at 12:16
• @DmitryKamenetsky No problem :) – ZanyG Jan 4 '20 at 12:25