What is the number of paths through all squares of a grid from bottom left to top right?

122 Views Asked by At

This is a problem that I set myself when I was at school. Find a formula $f(N,M)$ for the number of paths in an $N\times M$ grid starting at the bottom left, ending at the top right and going through every square once and only once.

I never was able to find a formula for this.

Is there a solution?