## Switch

A forum for good logic/math puzzles.

Moderators: jestingrabbit, Moderators General, Prelates

Jayraj
Posts: 15
Joined: Sun Oct 21, 2018 11:06 am UTC

### Switch

Rushing inside to the radio post, you attempt to turn on the equipment to call for help.

You find the workbench still unusable, but this time with a red light on its 'READY' indicator.

This means the workbench is powered but something must be missing to activate it.

You look around and find a dial with 16 led lights all turned off, numbered 1 to 16, and a note below saying :

"Light up all LEDs to activate radio. CAUTION :: Failing 4 times locks the entire system. Contact your supervisor if that happens."

Hastily, you begin to press the LED lights and sure enough, the lights are responsive… BUT things are never as simple as they look.

On your first attempt, you pressed the switch numbered 1, and you found that the number 1, 2 and 16 also lit up.

A few tries later, you realise that every time you press a LED, it switches its own state (On to Off or Off to On),

and those of the next and previous LED in order of their number.

There is also a reset button on top of the dial that turns off all the lights.

You press it, and exasperated, you let yourself fall into a chair as you ponder the problem before you…

How can you turn on all 16 lights?

pex
Posts: 10
Joined: Mon Mar 28, 2016 3:51 am UTC

### Re: Switch

Well, there's the obvious solution:
Spoiler:
Press every LED once. Now all of them have been toggled three times, so if they started all off, they're now all on.
I assume this can be sped up, but, meh. Edit: brute force says it cannot, actually.

DavidSh
Posts: 207
Joined: Thu Feb 25, 2016 6:09 pm UTC

### Re: Switch

Concerning pex's findings,
Spoiler:
Uniqueness of the solution shouldn't be surprising. You can write the problem as a linear equation over the integers modulo 2, in matrix form Ax=b, where x indicates the buttons you push, b is the vector of all ones, and A is a matrix where each row corresponds to the lights flipped by pushing a particular button. A can be seen to be a square matrix of full rank over the integers modulo 2; its determinant over the integers is odd.

pex
Posts: 10
Joined: Mon Mar 28, 2016 3:51 am UTC

### Re: Switch

Yeah, if you actually put some thought into it, it's not that surprising any more. Good catch!