2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
id: 5900f49b1000cf542c50ffae
|
|
|
|
title: 'Problem 303: Multiples with small digits'
|
2020-11-27 18:02:05 +00:00
|
|
|
challengeType: 5
|
2019-08-05 16:17:33 +00:00
|
|
|
forumTopicId: 301957
|
2021-01-13 02:31:00 +00:00
|
|
|
dashedName: problem-303-multiples-with-small-digits
|
2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --description--
|
|
|
|
|
2021-07-21 15:59:56 +00:00
|
|
|
For a positive integer $n$, define $f(n)$ as the least positive multiple of $n$ that, written in base 10, uses only digits $≤ 2$.
|
2020-11-27 18:02:05 +00:00
|
|
|
|
2021-07-21 15:59:56 +00:00
|
|
|
Thus $f(2) = 2$, $f(3) = 12$, $f(7) = 21$, $f(42) = 210$, $f(89) = 1\\,121\\,222$.
|
2020-11-27 18:02:05 +00:00
|
|
|
|
2021-07-21 15:59:56 +00:00
|
|
|
Also, $\displaystyle\sum_{n = 1}^{100} \frac{f(n)}{n} = 11\\,363\\,107$.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2021-07-21 15:59:56 +00:00
|
|
|
Find $\displaystyle\sum_{n = 1}^{10\\,000} \frac{f(n)}{n}$.
|
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-21 15:59:56 +00:00
|
|
|
`multiplesWithSmallDigits()` should return `1111981904675169`.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
```js
|
2021-07-21 15:59:56 +00:00
|
|
|
assert.strictEqual(multiplesWithSmallDigits(), 1111981904675169);
|
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-21 15:59:56 +00:00
|
|
|
function multiplesWithSmallDigits() {
|
2020-09-15 16:57:40 +00:00
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-07-21 15:59:56 +00:00
|
|
|
multiplesWithSmallDigits();
|
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
|
|
|
|
```
|