PROJECT EULER · #0459
Flipping Game
The flipping game is a two player game played on an
Each square contains a disk with one side white and one side black.
The game starts with all disks showing their white side.
A turn consists of flipping all disks in a rectangle with the following properties:
- the upper right corner of the rectangle contains a white disk
- the rectangle width is a perfect square (
, , , , ...) - the rectangle height is a triangular numberThe triangular numbers are defined as
for positive integer . ( , , , , ...)

Players alternate turns. A player wins by turning the grid all black.
Let
For

Find
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.