3
$\begingroup$

A machine has 2020 lights and 1 button. Each button press changes the state of exactly 3 of the lights. That means if the light is currently on, it turns off, and if the light is currently off, it turns on. Before each button press, the user selects which 3 lights will change their state.

To begin with, all the lights on the machine are off. What is the fewest number of button presses required in order for all the lights to be on?

Hint: Start by thinking about a machine with fewer lights.

$\endgroup$

1 Answer 1

7
$\begingroup$

I could be wrong, but is the answer:

674

Because:

If we'd take modulo-3 on 2020 there is 1 remaining. This means we'll have to get to a state with either 1 light turned on, or alternatively 4 (3+1) lights turned on. To do the second, we'll need 2 button-presses:

1. Turn 3 lights on
2. Turn 1 light off + 2 on (we now have 4 lights turned on)

After that there are 2020 - 4 = 2016 lights remaining, which we can all turn on as sets of three in 672 (2016 / 3) additional button-presses.

$\endgroup$
1
  • 1
    $\begingroup$ I think you're right, good job! $\endgroup$ Commented May 1, 2020 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.