Imagine there is a 7x7 grid of lights, and only the
middle in the grid is on.
The lights are wired such that when you flip the switch for one light (from on to off or off to on) the others next to it (not diagonally) flip as well.
Using this weird wiring of lights, what is the fewest number of switch changes it takes to turn all the lights off, and which lights should you switch?
Note: Assume all the switches work in the manner explained, and there is one switch for each of the lights.
I experimented a bit more. I was able to find all solutions
for grids from side length 3 to 27. For a range of lengths from 3 to 127, I also tried potential solutions of the form that begin with only
one button push in the center of the top row, and the pushes for all
other rows following from that. These solution worked only for the
squares n = (3, 7, 8, 9, 15, 19, 31, 39, 63, 79, and 127) Can you
see the two interleaved sequences?
The "one push" patterns are shown here. The next ones in the sequence
will be side lengths 159 and 255.... because the sequence seems to be
n=(2^i-1) and n=(10 * 2^j -1), so far, at least. I tested one-push
for n=1023 and that works as well - displayed here. Likewise,
n=2047 and n=2559 were found to work, as expected.
For the grids with all solutions found, n= 3 to 27, I counted
total number of different patterns that work (some are likely
not completely symmetric and so present as multiple rotations)
I also counted the number of solutions that had the same maximum
number of pushes and those that had the same minimum number of pushes.
There appears to be one min solution (minimum number of pushes)
and one max solution for each square size. (When there are four
counted, these are likely four rotations of one asymmetric pattern.)
These min and max pushes grids are displayed here. Table for n sides:
n solutions points points cnt cnt
(min) (max) (min) (max)
----------------------------------------
3 1 5 5 1 1
5 4 11 11 4 4
7 1 17 17 1 1
9 256 (2^8) 25 51 4 4
11 64 (2^4) 43 67 4 4
13 1 65 65 1 1
15 1 61 61 1 1
17 4 103 103 4 4
19 65536 (2^16) 93 219 4 4
21 1 125 125 1 1
23 16384 (2^14) 151 311 4 4
25 1 209 209 1 1
27 1 229 229 1 1
As mentioned, the results for the one-push top-row patterns are
displayed here. Only n=8 (which is not from either sequence)
shows an asymmetrical pattern). Table for squares solved with
the "top row one-push" pattern:
n i j points
---------------------
3 2 - 5
7 3 - 17
8 - - ? 25
9 - 0 35
15 4 - 61
19 - 1 123
31 5 - 217
39 - 2 439
63 6 - 773
79 - 3 1563
127 7 - 2753
So square sizes 19 and 23 have enormously more solution than
other size squares. I am not sure why. Patterns need to cancel
themselves out - perhaps these (19, 23) size scales are the
easiest for this stoplight pattern to self-cancel. I show here
for the case n=19 each 1000th solution (65 in total) here.
I see no pattern to these n=19 configurations. Perhaps the
expanding and contracting push patterns have a useful
self-cancelation column height commensurate with these
side lengths. The code is here.
Misc. References:
I find these patterns reminiscent of various other endeavors
into cellular automatons. The cross pattern for lighting
lights is a rule much like on John Conway's Game of Life,
which one may play.
Likewise the notion that the algorithms that yield changing
patterns are somehow fundamental in nature - as in Wolfram's
immodest tome "A New Kind of Science." These "lights-out"
puzzles show up often in Bart Bonte's
games - like Green here. (Check out his "Sugar, Sugar"
there too, just for the fun of it.)
Edited on November 18, 2022, 8:38 pm