Need Help With a Unique?? Problem

chillfan

New member
Joined
Feb 8, 2021
Messages
1
I'm sorry if this is the wrong section to post this in, but I'm not quite sure what category of math this problem falls into. I want to find out if there's a way to calculate (or just find) a path through a 15x15 grid which covers every square, and comes back to the square in which it started. In text, this is a bit confusing, but here's an image that might explain it better.

Untitled presentation.jpg

This is a solution to a 10x10 grid. Note how the path marked by the arrows passes through every square, and reaches the beginning again. There can't be any diagonal moves, only up, down, left, and right. The path also cannot cross itself. Is there any way to achieve this result on a 15x15 grid? I wouldn't be surprised if this is impossible, but if it is I'd really be interested in the mathematical reason why that might be. I've sat down and tried to create a working pattern just by guessing for around an hour, and couldn't find any good solutions. I'd really appreciate your help, thanks! :)
 
Let r = the number of cells in which the path exits to the right
Let l = the number of cells in which the path exits to the left

For a closed loop path then r=l. If this wasn't true then the path would finish either (r-l) cells to the right, or (l-r) cells to the left.

Similarly for the number of up and downward exits, given by variables u and d. For a closed loop path then u=d

If c is the total number of cells visited by a path, then c=r+l+u+d. For a closed loop then...

c = (r+l) + (u+d)
= (r+r)+(u+u) because r=l and u=d
= 2r+2u
= 2(r+u)

Therefore the number of cells visited must be even for a closed loop. This clearly isn't true for an n*n grid where n is odd. Try it on a 3*3 grid !
 
Top