fix(curriculum): clean-up Project Euler 361-380 (#43002)
* fix: clean-up Project Euler 361-380 * fix: improve wording Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com> * fix: remove unnecessary paragraph * fix: corrections from review Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com> Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
@ -10,7 +10,7 @@ dashedName: problem-366-stone-game-iii
|
||||
|
||||
Two players, Anton and Bernhard, are playing the following game.
|
||||
|
||||
There is one pile of n stones.
|
||||
There is one pile of $n$ stones.
|
||||
|
||||
The first player may remove any positive number of stones, but not the whole pile.
|
||||
|
||||
@ -18,20 +18,34 @@ Thereafter, each player may remove at most twice the number of stones his oppone
|
||||
|
||||
The player who removes the last stone wins.
|
||||
|
||||
E.g. n=5 If the first player takes anything more than one stone the next player will be able to take all remaining stones. If the first player takes one stone, leaving four, his opponent will take also one stone, leaving three stones. The first player cannot take all three because he may take at most 2x1=2 stones. So let's say he takes also one stone, leaving 2. The second player can take the two remaining stones and wins. So 5 is a losing position for the first player. For some winning positions there is more than one possible move for the first player. E.g. when n=17 the first player can remove one or four stones.
|
||||
E.g. $n = 5$
|
||||
|
||||
Let M(n) be the maximum number of stones the first player can take from a winning position at his first turn and M(n)=0 for any other position.
|
||||
If the first player takes anything more than one stone the next player will be able to take all remaining stones.
|
||||
|
||||
∑M(n) for n≤100 is 728.
|
||||
If the first player takes one stone, leaving four, his opponent will take also one stone, leaving three stones.
|
||||
|
||||
Find ∑M(n) for n≤1018. Give your answer modulo 108.
|
||||
The first player cannot take all three because he may take at most $2 \times 1 = 2$ stones. So let's say he also takes one stone, leaving 2.
|
||||
|
||||
The second player can take the two remaining stones and wins.
|
||||
|
||||
So 5 is a losing position for the first player.
|
||||
|
||||
For some winning positions there is more than one possible move for the first player.
|
||||
|
||||
E.g. when $n = 17$ the first player can remove one or four stones.
|
||||
|
||||
Let $M(n)$ be the maximum number of stones the first player can take from a winning position at his first turn and $M(n) = 0$ for any other position.
|
||||
|
||||
$\sum M(n)$ for $n ≤ 100$ is 728.
|
||||
|
||||
Find $\sum M(n)$ for $n ≤ {10}^{18}$. Give your answer modulo ${10}^8$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler366()` should return 88351299.
|
||||
`stoneGameThree()` should return `88351299`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler366(), 88351299);
|
||||
assert.strictEqual(stoneGameThree(), 88351299);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +53,12 @@ assert.strictEqual(euler366(), 88351299);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler366() {
|
||||
function stoneGameThree() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler366();
|
||||
stoneGameThree();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
Reference in New Issue
Block a user