User:Bemasher/The Traveling Salesman (grid-based)

The Traveling Salesman (grid-based)
Suppose you started in the top left cell of a grid of x by y cells. Your goal was to get to the far bottom right corner of the grid and you are only allowed to move right or down toward that cell. How many unique paths would there be between those two cells?

X x x x x x x x x x x x x x x x x x x x X

You could find the total unique solutions using the following product. Where y=10 and x=10.

$$\prod_{i=0}^{y-2}\frac{x+i}{i+1}=4\times7=28$$

Programming Solution
This problem could be solved using software as well. Though without special consideration the number of solutions couldn't exceed the the maximum value stored in an unsigned long which is 4294967295. The largest grid of equal length and width this code could compute is 19x19.

find_paths(current coordinates and dimensions of the grid) if current coordinates are the goal cell then return 1 else if current coordinates are within the bounds of the grid return sum of find_paths for one cell to the right and find_paths one cell down end if	end if end function

Below are all of the unique paths between the two cells of a 3x7 grid.

The code used to create the solutions could be something similar to below.