PROJECT EULER · #0986
Another Infinite Game
Peter is playing another game on an infinite row of squares, each square of which can hold an unlimited number of tokens.
Initially, every square contains a token.
Given positive integers
- Choose two tokens
and such that is squares to the right of . - Move both
and to the square that is squares to the right of .
Peter's goal is to move as many tokens as possible into one square. For example, with
... 1 1 1 1 1 1 1 1 ...
... 1 1 1 1 0 1 0 3 ...
... 1 1 1 0 0 0 2 3 ...
... 0 1 0 2 0 0 2 3 ...
... 0 0 0 1 2 0 2 3 ...
... 0 0 0 1 1 0 1 5 ...
... 0 0 0 1 0 0 0 7 ...
However, it is not possible to move
Let
Find the sum of
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.