P15
projecteuler.net

Lattice Paths

ℹ️Published on Friday, 19th April 2002, 06:00 pm; Solved by 201959;
Difficulty rating: 5%

Starting in the top left corner of a $2 \times 2$ grid, and only being able to move to the right and down, there are exactly $6$ routes to the bottom right corner.

How many such routes are there through a $20 \times 20$ grid?



Soluzione

Nel caso 2x2, i possibili percorsi sono dati dagli anagrammi delle mosse che dobbiamo compiere, ovvero due verso il basso (sud, sud) e due verso destra (est, est). Quindi

\[ \text{\# anagrammi SSEE} = \frac{4!}{2! \cdot 2!} = 6 \]

Allo stesso modo, nel caso 20x20 avremo da calcolare gli anagrammi della parola S..SE..E

BigInt(factorial(big(40)) / (factorial(big(20)) * factorial(big(20))))
137846528820

Last modified: August 18, 2025. Website built with Franklin.jl and the lovely Julia programming language.