2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
id: 5900f52c1000cf542c51003f
|
|
|
|
title: 'Problem 448: Average least common multiple'
|
2020-11-27 19:02:05 +01:00
|
|
|
challengeType: 5
|
2019-08-05 09:17:33 -07:00
|
|
|
forumTopicId: 302120
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: problem-448-average-least-common-multiple
|
2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --description--
|
|
|
|
|
2021-07-30 17:20:31 +02:00
|
|
|
The function $lcm(a, b)$ denotes the least common multiple of $a$ and $b$.
|
2020-11-27 19:02:05 +01:00
|
|
|
|
2021-07-30 17:20:31 +02:00
|
|
|
Let $A(n)$ be the average of the values of $lcm(n, i)$ for $1 ≤ i ≤ n$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 17:20:31 +02:00
|
|
|
E.g: $A(2) = \frac{2 + 2}{2} = 2$ and $A(10) = \frac{10 + 10 + 30 + 20 + 10 + 30 + 70 + 40 + 90 + 10}{10} = 32$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 17:20:31 +02:00
|
|
|
Let $S(n) = \sum A(k)$ for $1 ≤ k ≤ n$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 17:20:31 +02:00
|
|
|
$S(100) = 122\\,726$.
|
|
|
|
|
|
|
|
Find $S(99\\,999\\,999\\,019)\bmod 999\\,999\\,017$.
|
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-30 17:20:31 +02:00
|
|
|
`averageLCM()` should return `106467648`.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
```js
|
2021-07-30 17:20:31 +02:00
|
|
|
assert.strictEqual(averageLCM(), 106467648);
|
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-30 17:20:31 +02:00
|
|
|
function averageLCM() {
|
2020-09-15 09:57:40 -07:00
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-07-30 17:20:31 +02:00
|
|
|
averageLCM();
|
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
|
|
|
|
```
|