A PUZZLE MADE OF EVEN AND ODD

The Square Lanterns

Every lantern carries a number, and every number burns a flame for each prime it holds an odd number of times. Light lanterns together and matching flames put each other out. When every flame is out, the numbers you lit multiply to a perfect square.

First light

Light a lantern to begin.

Why this works

A number is a perfect square when every prime in it appears an even number of times: 900 = 2² · 3² · 5². Multiplying numbers adds their exponents, so only even and odd matter. Write a 1 for odd and a 0 for even and each lantern becomes a row of bits; lighting two lanterns adds their rows, and in this arithmetic adding is XOR. A set of rows that adds up to all zeros is a set of numbers whose product is a square.

The line under the lanterns is the square split, product = r² + rem, with r the whole-number square root. The remainder is zero exactly when you have won.

The Square Lanterns · by Lars Rocha · the solver is gf2.js: sets for rows and columns, singleton stripping, lightest-column pivots, and Montgomery's block Lanczos over GF(2).