Home > Riddles > The traffic light that reprograms itself

The traffic light that reprograms itself

Chance and uncertaintyLevel 1 · Starter · ●○○○○

An experimental traffic light has three lights: red ($R$), yellow ($A$), and green ($V$).
Every minute, the state of the next minute is calculated like this:

  • $R$ is turned on if and only if $A$ was turned off.
  • $A$ is turned on if and only if $V$ was turned on.
  • $V$ is turned on if and only if $R$ was turned on.

Initial state (minute 0):

$$ (R,A,V)=(0,0,0), $$

where 0 = off and 1 = on.
At what minute are all three turned off again for the first time after minute 0?

Didactic closure of the level

If you detect the correct invariant, the problem is solved without exploring long sequences.

Hints

Show hints
  1. The first repetition of the “all off” state after startup occurs at t=6.
  2. Rules: R_ t+1 =neg A_t, A_ t+1 =V_t, V_ t+1 =R_t.
  3. Final section: t=6: The first repetition of the “all off” state after the start occurs at t=6. Then, rules: R_ t+1 =neg A_t, A_ t+1 =V_t, V_ t+1 =R_t.

Solution

Show full solution

Back to problem
Answer: minute 6.
Rules:

$$ R_{t+1}=\neg A_t,\quad A_{t+1}=V_t,\quad V_{t+1}=R_t. $$

With initial state $(R,A,V)=(0,0,0)$:

  • $t=0$: $(0,0,0)$
  • $t=1$: $(1,0,0)$
  • $t=2$: $(1,0,1)$
  • $t=3$: $(1,1,1)$
  • $t=4$: $(0,1,1)$
  • $t=5$: $(0,1,0)$
  • $t=6$: $(0,0,0)$

The first repetition of the “all off” state after startup occurs at $t=6$.

Related riddles

Keep practicing

If you enjoyed this one, try more pure-logic riddles, explore this theme, browse the full archive, or read the riddle-solving guide.

← Previous: Ten pieces and the black impossible · Next: Mutilated board and dominoes →