2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
id: 5900f4f81000cf542c51000b
|
|
|
|
title: 'Problem 396: Weak Goodstein sequence'
|
2020-11-27 19:02:05 +01:00
|
|
|
challengeType: 5
|
2019-08-05 09:17:33 -07:00
|
|
|
forumTopicId: 302061
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: problem-396-weak-goodstein-sequence
|
2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --description--
|
|
|
|
|
2021-07-30 16:59:29 +02:00
|
|
|
For any positive integer $n$, the $n$th weak Goodstein sequence $\\{g1, g2, g3, \ldots\\}$ is defined as:
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 16:59:29 +02:00
|
|
|
- $g_1 = n$
|
|
|
|
- for $k > 1$, $g_k$ is obtained by writing $g_{k - 1}$ in base $k$, interpreting it as a base $k + 1$ number, and subtracting 1.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 16:59:29 +02:00
|
|
|
The sequence terminates when $g_k$ becomes 0.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 16:59:29 +02:00
|
|
|
For example, the $6$th weak Goodstein sequence is $\\{6, 11, 17, 25, \ldots\\}$:
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 16:59:29 +02:00
|
|
|
- $g_1 = 6$.
|
|
|
|
- $g_2 = 11$ since $6 = 110_2$, $110_3 = 12$, and $12 - 1 = 11$.
|
|
|
|
- $g_3 = 17$ since $11 = 102_3$, $102_4 = 18$, and $18 - 1 = 17$.
|
|
|
|
- $g_4 = 25$ since $17 = 101_4$, $101_5 = 26$, and $26 - 1 = 25$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
and so on.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
It can be shown that every weak Goodstein sequence terminates.
|
|
|
|
|
2021-07-30 16:59:29 +02:00
|
|
|
Let $G(n)$ be the number of nonzero elements in the $n$th weak Goodstein sequence.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 16:59:29 +02:00
|
|
|
It can be verified that $G(2) = 3$, $G(4) = 21$ and $G(6) = 381$.
|
|
|
|
|
|
|
|
It can also be verified that $\sum G(n) = 2517$ for $1 ≤ n < 8$.
|
|
|
|
|
|
|
|
Find the last 9 digits of $\sum G(n)$ for $1 ≤ n < 16$.
|
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 16:59:29 +02:00
|
|
|
`weakGoodsteinSequence()` should return `173214653`.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
```js
|
2021-07-30 16:59:29 +02:00
|
|
|
assert.strictEqual(weakGoodsteinSequence(), 173214653);
|
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 16:59:29 +02:00
|
|
|
function weakGoodsteinSequence() {
|
2020-09-15 09:57:40 -07:00
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-07-30 16:59:29 +02:00
|
|
|
weakGoodsteinSequence();
|
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
|
|
|
|
```
|