2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
id: 5900f4111000cf542c50ff23
|
2020-11-27 18:02:05 +00:00
|
|
|
title: >-
|
|
|
|
Problem 164: Numbers for which no three consecutive digits have a sum greater
|
|
|
|
than a given value
|
2018-09-30 22:01:58 +00:00
|
|
|
challengeType: 5
|
2019-08-05 16:17:33 +00:00
|
|
|
forumTopicId: 301798
|
2021-01-13 02:31:00 +00:00
|
|
|
dashedName: >-
|
|
|
|
problem-164-numbers-for-which-no-three-consecutive-digits-have-a-sum-greater-than-a-given-value
|
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-12 14:19:03 +00:00
|
|
|
How many 20 digit numbers $n$ (without any leading zero) exist such that no three consecutive digits of $n$ have a sum greater than 9?
|
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-12 14:19:03 +00:00
|
|
|
`consecutiveDigitsSum()` should return `378158756814587`.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
```js
|
2021-07-12 14:19:03 +00:00
|
|
|
assert.strictEqual(consecutiveDigitsSum(), 378158756814587);
|
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-12 14:19:03 +00:00
|
|
|
function consecutiveDigitsSum() {
|
2020-09-15 16:57:40 +00:00
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-07-12 14:19:03 +00:00
|
|
|
consecutiveDigitsSum();
|
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
|
|
|
|
```
|