2018-09-30 23:01:58 +01:00
---
id: 5900f4cb1000cf542c50ffdd
title: 'Problem 350: Constraining the least greatest and the greatest least'
2020-11-27 19:02:05 +01:00
challengeType: 5
2019-08-05 09:17:33 -07:00
forumTopicId: 302010
2021-01-13 03:31:00 +01:00
dashedName: problem-350-constraining-the-least-greatest-and-the-greatest-least
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2021-07-29 19:14:22 +02:00
A list of size $n$ is a sequence of $n$ natural numbers. Examples are (2, 4, 6), (2, 6, 4), (10, 6, 15, 6), and (11).
2018-09-30 23:01:58 +01:00
2021-07-29 19:14:22 +02:00
The greatest common divisor, or $gcd$, of a list is the largest natural number that divides all entries of the list. Examples: $gcd(2, 6, 4) = 2$, $gcd(10, 6, 15, 6) = 1$ and $gcd(11) = 11$.
2018-09-30 23:01:58 +01:00
2021-07-29 19:14:22 +02:00
The least common multiple, or $lcm$, of a list is the smallest natural number divisible by each entry of the list. Examples: $lcm(2, 6, 4) = 12$, $lcm(10, 6, 15, 6) = 30$ and $lcm(11) = 11$.
2018-09-30 23:01:58 +01:00
2021-07-29 19:14:22 +02:00
Let $f(G, L, N)$ be the number of lists of size $N$ with $gcd ≥ G$ and $lcm ≤ L$. For example:
2018-09-30 23:01:58 +01:00
2021-07-29 19:14:22 +02:00
$$\begin{align}
& f(10, 100, 1) = 91 \\\\
& f(10, 100, 2) = 327 \\\\
& f(10, 100, 3) = 1135 \\\\
& f(10, 100, 1000)\bmod {101}^4 = 3\\,286\\,053
\end{align}$$
2018-09-30 23:01:58 +01:00
2021-07-29 19:14:22 +02:00
Find $f({10}^6, {10}^{12}, {10}^{18})\bmod {101}^4$.
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:14:22 +02:00
`leastGreatestAndGreatestLeast()` should return `84664213` .
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
2021-07-29 19:14:22 +02:00
assert.strictEqual(leastGreatestAndGreatestLeast(), 84664213);
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:14:22 +02:00
function leastGreatestAndGreatestLeast() {
2020-09-15 09:57:40 -07:00
2018-09-30 23:01:58 +01:00
return true;
}
2021-07-29 19:14:22 +02:00
leastGreatestAndGreatestLeast();
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
```