# Sum constrained number route grid

Take a blank 6x6 grid (2-dimensional matrix). Pick a cell to start, and write the number 1 in that cell. Then move to an adjacent cell horizontally or vertically. Write 2 in that cell. Continue to move in the same manner, horizontally or vertically, incrementing the number in the cell by 1 each time. You terminate when you have the numbers 1 to 36 inclusive in the matrix. The rightmost column sums to 127. The bottommost row sums to 101. What is the route?

• Are computer allowed? I'd assume you wouldn't want to allow computers for this kind of puzzle. Sep 9, 2019 at 20:57

Through some trial and error, I've managed to find a solution.

• Well done @hexomino. This is the unique solution. Out of the 458696 possible 6x6 route number squares, it is the only one meeting my criteria. Sep 10, 2019 at 17:40
• @PaulRichards There is still a crucial lack of a proof of this fact. Sep 10, 2019 at 21:29
• @ArnaudMortier yes I can't offer a simple proof. The only proof I have is by exhaustion, I have a list of all 458696 alternatives and their column/row totals. Sep 11, 2019 at 17:57

Two families of configurations are ruled out:

Six consecutive numbers would sum up to $$6k+3$$, which neither of $$127$$ or $$101$$ is.
Two groups of three consecutive numbers would sum up to a multiple of $$3$$, which neither of $$127$$ or $$101$$ is.

Therefore

The last row/column contain either three couples of consecutive numbers, or four consecutive numbers + two consecutive numbers, or the starting or ending point with whatever configuration besides.

A trickier family that is excluded:

Assume that all numbers from the last row are less than or equal to the bottom-right number (call it $$k$$), while all numbers from the last column are greater than or equal to $$k$$. Then $$101\leq 6k-15$$ and $$6k+15\leq 127$$, which is clearly impossible ($$101$$ and $$127$$ are too close to each other). Therefore our snake does some part of the bottom row, leaves it and does (potentially all but at least part of) the last column, and comes back to finish the last row.

Keep in mind that

when the second of the SW and NE corners is reached, meaning there is a path joining them, one of the two halves of the matrix (on either side of that path) has to be completely filled - otherwise we could not complete the square.

• Couldn't one or both of the lines be the start and/or end and then include 3 consecutive numbers and a pair of consecutive numbers? Sep 10, 2019 at 0:42
• @DrXorile Yes, this is exactly what I mean by "or the starting or ending point with whatever configuration besides." Sep 10, 2019 at 8:17