3
$\begingroup$

Can you paint the cells of a 5x5 grid in 5 colours such that for each cell its colour and the colour of its orthogonal (horizontal and vertical) neighbours are all different?

$\endgroup$

3 Answers 3

5
$\begingroup$

Someone had the right idea:

abcde
cdeab
eabcd
bcdea
deabc

Now in Technicolor, so you can see it for yourself:

a 5x5 grid matching the pattern in the first spoiler block

$\endgroup$
6
  • 1
    $\begingroup$ And the same applies for the diagonal neighbours independently. And the edges "wrap". $\endgroup$ Oct 27 at 14:03
  • $\begingroup$ This is correct, well done! Love the technicolor :) $\endgroup$ Oct 27 at 14:04
  • $\begingroup$ I wonder why, mathematically, rot13(ebgngvat nopqr ol gjb naq guerr) yield valid solutions. Does it have anything to do with rot13(zbqhyne nevguzrgvp)? $\endgroup$
    – Someone
    Oct 27 at 14:15
  • $\begingroup$ @Someone I think it's more that they're effectively mirrors of the same operation. if you were to flip the board over horizontally and relabel the colors I'm pretty sure one would come out as the other $\endgroup$
    – juicifer
    Oct 27 at 14:22
  • $\begingroup$ Yeah, they're interchangeable, and reflections of each other. But I'm having trouble finding a non-trivial non-bonus solution. $\endgroup$
    – Someone
    Oct 27 at 14:23
3
$\begingroup$

Trivial Solution (similar to others')

And of course, it also grabs the bonus:

Let a, b, c, d, e be the colors. Then:
| a | b | c | d | e |
| d | e | a | b | c |
| b | c | d | e | a |
| e | a | b | c | d |
| c | d | e | a | b |

How I got there:

If you take abcde, place it in the first row, and then right-shift it by three for each row, you get this system.

$\endgroup$
10
  • $\begingroup$ Oh, I misread the question. Might as well look for another solution… $\endgroup$
    – Someone
    Oct 27 at 14:10
  • $\begingroup$ I made it more readable but unfortunately tables don't work in spoilers. $\endgroup$ Oct 27 at 14:10
  • $\begingroup$ Alright, actual solution now. $\endgroup$
    – Someone
    Oct 27 at 14:15
  • $\begingroup$ Is this the same solution as the accepted one? Are there any other solutions (perhaps without the bonus)? $\endgroup$ Oct 27 at 14:16
  • $\begingroup$ They're not the same, but they have a similar idea to each other and my first solution—rot13(gnxr n ebj bs gur svir pbybef naq fuvsg gurz nebhaq). $\endgroup$
    – Someone
    Oct 27 at 14:17
0
$\begingroup$

Initially I assumed this was a Latin square question (but that was not actually mentioned). I got the following symmetrical solution:

Rainbowish colored 5x5 matrix

$\endgroup$
9
  • $\begingroup$ This doesn't work, sorry. It wasn't a latin square question, but it turned into one :) $\endgroup$ Oct 28 at 9:45
  • $\begingroup$ That was my original solution, but I misread the question. $\endgroup$
    – Someone
    Oct 28 at 16:30
  • $\begingroup$ @DmitryKamenetsky Well this is disappointing. I have received two downvotes for my answer even though none of my colored squares have a horizontal or vertical neighbour of the same color. Plus I did use 5 colors as requested. I feel I have correctly answered the question that was asked. $\endgroup$ Oct 28 at 19:44
  • 2
    $\begingroup$ @WeatherVane Okay! I see the difference now. I had interpreted the question to only mean that each cell would be colored different from its orthogonal neighbours but now I see that also the 4 orthogonal neighbours must all be distinctly colored. $\endgroup$ Oct 28 at 23:29
  • 1
    $\begingroup$ @DmitryKamenetsky Thanks! Sometimes it’s hard to word things simply and clearly. I thought about how I would word your question and I couldn’t think of a simple way to express it. $\endgroup$ Oct 29 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.