2018-09-30 23:01:58 +01:00
---
id: 5900f5091000cf542c51001b
title: 'Problem 408: Admissible paths through a grid'
2020-11-27 19:02:05 +01:00
challengeType: 5
2019-08-05 09:17:33 -07:00
forumTopicId: 302076
2021-01-13 03:31:00 +01:00
dashedName: problem-408-admissible-paths-through-a-grid
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2018-09-30 23:01:58 +01:00
2021-07-29 19:48:24 +02:00
Let's call a lattice point ($x$, $y$) inadmissible if $x$, $y$ and $x + y$ are all positive perfect squares.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
For example, (9, 16) is inadmissible, while (0, 4), (3, 1) and (9, 4) are not.
2018-09-30 23:01:58 +01:00
2021-07-29 19:48:24 +02:00
Consider a path from point ($x_1$, $y_1$) to point ($x_2$, $y_2$) using only unit steps north or east. Let's call such a path admissible if none of its intermediate points are inadmissible.
2018-09-30 23:01:58 +01:00
2021-07-29 19:48:24 +02:00
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) = 596\\,994\\,440$ and $P(1\\,000)\bmod 1\\,000\\,000\\,007 = 341\\,920\\,854$.
2018-09-30 23:01:58 +01:00
2021-07-29 19:48:24 +02:00
Find $P(10\\,000\\,000)\bmod 1\\,000\\,000\\,007$.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
# --hints--
2018-09-30 23:01:58 +01:00
2021-07-29 19:48:24 +02:00
`admissiblePaths()` should return `299742733` .
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
2021-07-29 19:48:24 +02:00
assert.strictEqual(admissiblePaths(), 299742733);
2018-09-30 23:01:58 +01:00
```
2020-11-27 19:02:05 +01:00
# --seed--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
## --seed-contents--
2018-09-30 23:01:58 +01:00
```js
2021-07-29 19:48:24 +02:00
function admissiblePaths() {
2020-09-15 09:57:40 -07:00
2018-09-30 23:01:58 +01:00
return true;
}
2021-07-29 19:48:24 +02:00
admissiblePaths();
2018-09-30 23:01:58 +01:00
```
2020-11-27 19:02:05 +01:00
# --solutions--
2018-09-30 23:01:58 +01:00
```js
// solution required
```