0%

Problem 408


Problem 408


Admissible paths through a grid

Let’s call a lattice point (x, y) inadmissible if x, y and x + y are all positive perfect squares.
For example, (9, 16) is inadmissible, while (0, 4), (3, 1) and (9, 4) are not.

Consider a path from point (x1, y1) to point (x2, y2) using only unit steps north or east.
Let’s call such a path admissible if none of its intermediate points are inadmissible.

Let P(n) be the number of admissible paths from (0, 0) to (n, n).
It can be verified that P(5) = 252, P(16) = 596994440 and P(1000) mod 1 000 000 007 = 341920854.

Find P(10 000 000) mod 1 000 000 007.


穿越方格的容许路径

我们称格点(x, y) 不容许的,如果x, y和x + y均为正平方数。
例如,(9, 16)是不容许的, 而(0, 4), (3, 1)和(9, 4)都不是。

考虑从点(x1, y1)到点(x2, y2)的路径,路径上每次只能往北或往东走一步。
我们称路径是容许的,如果路径经过的点都不是不容许的。

记P(n)为从(0, 0)到(n, n)的容许路径总数。
可以验证P(5) = 252, P(16) = 596994440以及P(1000) mod 1 000 000 007 = 341920854。

求P(10 000 000) mod 1 000 000 007。