What is the minimal grid size for which the property stated in this problem still holds?

78 Views Asked by At

The following is a Russian Mathematical Olympiad problem from 1999 (source)

Each cell of a 50×50 square is colored in one of four colors. Show that there exists a square which has cells of the same color as it directly above, directly below, directly to the left, and directly to the right of it (though not necessarily adjacent to it).

I'm curious what the minimal grid size such that the property still holds for $n$ colors is. It's pretty clear from the given proof technique that 50 is not minimal for 4 colors.