2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
id: 5900f5061000cf542c510017
|
|
|
|
title: 'Problem 409: Nim Extreme'
|
2020-11-27 19:02:05 +01:00
|
|
|
challengeType: 5
|
2019-08-05 09:17:33 -07:00
|
|
|
forumTopicId: 302077
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: problem-409-nim-extreme
|
2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --description--
|
|
|
|
|
2021-07-29 19:48:24 +02:00
|
|
|
Let $n$ be a positive integer. Consider nim positions where:
|
2020-11-27 19:02:05 +01:00
|
|
|
|
2021-07-29 19:48:24 +02:00
|
|
|
- There are $n$ non-empty piles.
|
|
|
|
- Each pile has size less than $2^n$.
|
|
|
|
- No two piles have the same size.
|
2020-11-27 19:02:05 +01:00
|
|
|
|
2021-07-29 19:48:24 +02:00
|
|
|
Let $W(n)$ be the number of winning nim positions satisfying the above conditions (a position is winning if the first player has a winning strategy).
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-29 19:48:24 +02:00
|
|
|
For example, $W(1) = 1$, $W(2) = 6$, $W(3) = 168$, $W(5) = 19\\,764\\,360$ and $W(100)\bmod 1\\,000\\,000\\,007 = 384\\,777\\,056$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-29 19:48:24 +02:00
|
|
|
Find $W(10\\,000\\,000)\bmod 1\\,000\\,000\\,007$.
|
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-29 19:48:24 +02:00
|
|
|
`nimExtreme()` should return `253223948`.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
```js
|
2021-07-29 19:48:24 +02:00
|
|
|
assert.strictEqual(nimExtreme(), 253223948);
|
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-29 19:48:24 +02:00
|
|
|
function nimExtreme() {
|
2020-09-15 09:57:40 -07:00
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-07-29 19:48:24 +02:00
|
|
|
nimExtreme();
|
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
|
|
|
|
```
|