2018-09-30 22:01:58 +00:00
---
id: 5900f5001000cf542c510013
title: 'Problem 403: Lattice points enclosed by parabola and line'
2020-11-27 18:02:05 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 302071
2021-01-13 02:31:00 +00:00
dashedName: problem-403-lattice-points-enclosed-by-parabola-and-line
2018-09-30 22:01:58 +00:00
---
2020-11-27 18:02:05 +00:00
# --description--
2018-09-30 22:01:58 +00:00
2021-07-29 17:48:24 +00:00
For integers $a$ and $b$, we define $D(a, b)$ as the domain enclosed by the parabola $y = x^2$ and the line $y = ax + b: D(a, b) = \\{ (x, y) | x^2 ≤ y ≤ ax + b \\}$.
2018-09-30 22:01:58 +00:00
2021-07-29 17:48:24 +00:00
$L(a, b)$ is defined as the number of lattice points contained in $D(a, b)$. For example, $L(1, 2) = 8$ and $L(2, -1) = 1$.
2018-09-30 22:01:58 +00:00
2021-07-29 17:48:24 +00:00
We also define $S(N)$ as the sum of $L(a, b)$ for all the pairs ($a$, $b$) such that the area of $D(a, b)$ is a rational number and $|a|,|b| ≤ N$.
2018-09-30 22:01:58 +00:00
2021-07-29 17:48:24 +00:00
We can verify that $S(5) = 344$ and $S(100) = 26\\,709\\,528$.
Find $S({10}^{12})$. Give your answer $\bmod {10}^8$.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
# --hints--
2018-09-30 22:01:58 +00:00
2021-07-29 17:48:24 +00:00
`latticePoints()` should return `18224771` .
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
2021-07-29 17:48:24 +00:00
assert.strictEqual(latticePoints(), 18224771);
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --seed--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
## --seed-contents--
2018-09-30 22:01:58 +00:00
```js
2021-07-29 17:48:24 +00:00
function latticePoints() {
2020-09-15 16:57:40 +00:00
2018-09-30 22:01:58 +00:00
return true;
}
2021-07-29 17:48:24 +00:00
latticePoints();
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --solutions--
2018-09-30 22:01:58 +00:00
```js
// solution required
```