# Odd hours with two timers

Two motorized 24-hour light timers are daisy chained between a power outlet and a light bulb.

For these timers, devise schedules and choose initial times that produce the following repeated 9-hour lighting pattern, with the largest possible whole number $d$ less than 9, beginning when the outlet's power is switched on.

Light is on for $\:d~$ hours,$~$ off for $\,9\,$–$\:d~~$ hours,
on for $\:d~$ hours,$~$ off for $\,9\,$–$\:d~~$ hours,
on for $\:d~$ hours,$~$ off for $\,9\,$–$\:d~~$ hours,
$~\,\vdots$

If you are unfamiliar with these timers

Each timer repeatedly cycles through its schedule of 24 intervals that last an hour each.
•$~$ A circular dial determines the current point in the schedule
•$~$ A motor rotates the dial to advance through its schedule whenever power is supplied to the timer
•$~$ You may initially set the dial to any minute of any interval
•$~$ You preset each interval to ON or OFF
•$~$ When the dial is in an interval that was set to ON, the timer acts as a direct connection for power to flow to whatever is plugged into the timer
•$~$ When the dial is in an interval that was set to OFF, the timer does not provide a power connection
•$~$ The resulting ON and OFF durations could be fractions of an hour if the timer is set to begin within an interval or if incoming power is interrupted during an interval

The first timer is plugged into the outlet.
•$~$ It runs nonstop once the outlet is switched on
•$~$ It supplies power— but only when its dial is in an ON interval — to the second timer

The second timer has the light bulb plugged into it.
•$~$ It advances through its schedule only when the first timer supplies power
•$~$ It lights the bulb, but only while powered by the first timer and when its dial is in an ON interval

(This puzzle is directly from an actual botany experiment)

Obviously, you can't obtain a 9 hour cycle with just one 24 hour timer, because 24 is no integer multiple of 9. So there have to be hours at which the first timer is turned off. As the first timer runs at a 24 hour cycle, it will be off at certain fixed hours every day.

The greatest common divisor of 24 and 9 is 3, so the 9-hour cycle occurs at all phase shifts that are multiples of three. If the on-time is at least 3 hours, there is no hour the bulb is off every day, which contradicts the observation that there must be such hours. So obviously $d \le 2$.

I will show a solution with $d = 2$, which thus is optimal. Set the first timer to 8 copies of 2 hours on and 1 hour off. The second timer is powered 6 hours per 9 hour interval. As 6 is a divider of 24, it is possible to program the second timer in a way that it has a cycle repeating every 6 hours it is powered, which is 9 hours real time. Set the timer to 4 copies of 2 hours on and 4 hours off, and have both timers start at the beginning of their on phases.

• Won't this produce a pattern of 2 on, 4 off, not 2 on 7 off? (At the start of the seventh hour, both timers are back to their initial pattern positions of on)
– Matt
Jan 21 '16 at 19:44
• No. The second timer does not advance while the first timer is off. So it off the 4 hours it is powered as well as three extra hours while it is unpowered. Jan 21 '16 at 19:48
• Incidentally, this solution beats real timers, which produced flickers at hours before and after they tried to turn on or off at the same time
– humn
Jan 21 '16 at 21:24

Set both timers to be always on.

d = 9;

On for 9 hours, off for 0 hours, on for 9 hours, off for 0 hours.

• I'll double check my math, but it seems your solution is a 1/2 hour too long, producing a cycle of 9 1/2 hours on and 0 hours off.
– humn
Jan 21 '16 at 13:54
• Where does the extra half hour come from? Surely a cycle of 9 1/2 on and 0 hours off is the same as 9 hours on and 0 hours off. Jan 21 '16 at 14:26
• My answer wasn't meant as a serious one though, personally I'd limit it to 8 or less in the question Jan 21 '16 at 14:27
• @CallumBradbury I guess human's comment also wasn't a serious one :P Jan 21 '16 at 14:30
• Right, @CallumBradbury , clarified, and enjoyed
– humn
Jan 21 '16 at 14:37

A first (serious) attempt:

Set the first timer to be on for 2 and off for 1 (and repeating forever), starting at the beginning of the on cycle.
Set the second timer to be on for 2 hour and off for 4 (and repeating forever), starting at the beginning of the on cycle.
Then the light will go on for 2 hours and stay off for 7 hours and repeat forever.

I don't know if this can be improved upon, but I'd be a little surprised. The first timer extends the time taken for the second (so that it takes 3 hours to move 2 hours on the second timer). Other options would be that it takes 6 hours to move 4 hours, but then it will get out of sync with the 9 hours cycle (unless something very clever happens with syncing over multiple cycles). The ideal would be 9 hours to move 6, but 9 hours doesn't divide into 24.

• You got it. Would be nice to have a way to officially accept/acknowledge more than one answer
– humn
Jan 21 '16 at 21:31