# Day and night of the two timers

### Make a non - 24 - hour day /night cycle            with the most daylight and fewest pieces

Specifically, devise schedules and an arrangement for two electromechanical 24 - hour light timers to control the flow of power from an outlet to a light bulb. The challenge is to obtain the following repeated lighting pattern with the largest possible number D, while N is a nonzero constant other than  24 −  D , beginning when the outlet's power is switched on.

Light is on for D hours, off for N hours,
on for D hours, off for N hours,
on for D hours, off for N hours,
. . .

To reduce complications:
🕛  When power is initially switched on, both dials point to midnight
🛇  The timers may never simultaneously be at transitions in their schedules (from OFF to ON or from ON to OFF, whether the same or different between the timers) even though the power switch may initially turn them on simultaneously

### The arrangement can be considered a jigsaw puzzle (and can be simple enough to be described in words)

The example above shows much of what is allowed, although one timer is missing.
•  Use 1 outlet, 2 timers and 1 light bulb
•  Use the fewest possible plugs, wires, sockets and socket multipliers
•  Pieces may be flipped and rotated but not overlapped
•  Any number of tabs and slots may remain unlinked
•  The layout may include uncovered areas
•  Power flows through matched tabs and slots
•  The outlet is the sole source of power
•  When a timer is in an OFF interval power can only flow into into it, not through it

If you are unfamiliar with these timers

Each timer repeatedly cycles through its schedule of 24 intervals that last an hour each.
•  You preset each interval to ON or OFF
•  A circular dial determines the current point in the schedule
•  The dial advances along its schedule when, and only when, power flows into the timer and its dial-rotating motor
•  When the dial is in an interval that was set to ON, the timer acts as a direct connection for power to flow between what is plugged into it and what it plugs into
•  When the dial is in an interval that was set to OFF, the timer does not provide a power connection

Warm-up puzzles
Day:     Odd hours with two timers
Night:      Halve time with two timers
Related: Third timer's a charm   (has a sample answer meant to help)

(This puzzle comes directly from an actual botany experiment)

Small hint — a possibility implied by these pieces' old-fashioned circuitry:

A socket multiplier is not strictly a one-way component. Power can flow out through its plug and in through its sockets. This even allows for power to flow between pieces plugged into a multiplier's sockets, whether or not the multiplier is itself plugged into anything.

Big hint — another possibility implied by these pieces' old-fashioned circuitry:

A timer is not strictly a one-way device. When a timer is in an ON interval, power may flow in or out through both its plug and its socket. If power flows in only through the socket:
•  The motor rotates the dial forward along its schedule
•  The timer cannot reliably advance itself into an OFF interval, so (1) the intervals during that portion of the schedule must all be set to ON and (2) power must be supplied through the timer's plug before and during the next OFF interval

• Please clarify what you mean with your last sentence: " If power flows in only through the socket: -The timer cannot reliably advance itself into an OFF interval" – The Dark Truth Jan 27 '16 at 8:22
• Okay, @TheDarkTruth, "...cannot reliably advance itself..." has now been elaborated, possibly not for the last time – humn Jan 27 '16 at 8:45
• Why couldn't they put diodes in?! – boboquack Mar 5 '17 at 4:21
• @humn, I'm somewhat unclear on the wording and the requirements you've described. Does a "socket-powered" timer "pause in the ON position" at a ON->OFF border until the plug is powered? Does the requirement you imposed that "The timers may never simultaneously be at transitions in their schedules" mean that we are not supposed to let this condition ever occur? – tmpearce Mar 6 '17 at 21:57
• Right, @tmpearce, the most important reason for the non-simultaneity condition is to avoid socket-powered transitions. (Real timers can sometimes turn themselves off that way, and certainly puzzle timers could, but this puzzle is challenging enough and the solution is better constrained without that possibility.) Perhaps the hints should be unhidden. – humn Mar 6 '17 at 22:19

I'm not entirely sure that my interpretation of how the backwards timer works is entirely correct, but if it works like this:

When the timer is ON (in a time interval where the switch is closed), then the light can be powered in reverse (supplying power the "wrong" way).

When the timer is OFF (in a time interval where the switch is open), supplying power the "wrong" way does nothing. Whether or not the timer continues to click will depend entirely on whether or not the timer is powered from the "right" direction.

When the timer is transitioning from ON to OFF or vice versa, if the timer is not powered from the "right" direction, then maybe it will just blow up. So it always has to be powered from the right direction during a transition, but may be powered from the wrong direction also.

Then I think I can get

D=12, N=4, although I'm not sure that this is the best solution you can get.

Here's the diagram (pardon the mess):

 (wire) _____ _____ /===================\ | . . |<| . . |<<======/ _____ | |_____| | . . |<(timer B)<| . . |<(timer A)<=/ | . . | | . . |<(LIGHT) |_____| | . . | |_____| 

Which involves 2 socket multipliers, 1 wire (male-to-male), and the outlet-timers-light setup.

(For extra clarity: the outlet is plugged into timer A (in reverse) and timer B (normally. The other (pronged) end of timer A, the other (output) end of timer B, and the light are all connected at the same socket multiplier.)

In this setup, the light will be on when either timer A OR B is set ON, and only off when both A and B are set OFF.

Here's how we'd set the timers, and what would happen:

Set timer A to be OFF during the hours: 1, 2, 13, 14

Set timer B to be OFF during the hours: 2,3,4,5,10,11,12,13,18,19,20,21 (off four hours, on four hours, starting at 02:00)

This basically puts timer A on a 32 hour cycle, since it will become unpowered for four hours at 2am and 2pm every "day". And since timer B is essentially on an 8 hour cycle, it behaves exactly the same through each cycle of timer A, we don't need to worry about them becoming de-synced.

The 32 hour cycle of timer A is below. I've put dots above each hour when timer B will be off, and parentheses around all the hours that timer A will be off; the light bulb will be on only when these coincide (the hours indicated by a hyphen).

 . . . . . . . . ( 1 - - - - 2) 3 4 5 6 7 8 9 10 11 12 . . . . . . . . (13 - - - - 14)15 16 17 18 19 20 21 22 23 24 

• Everything checks out perfectly! Well worth retuning for even more light. – humn Mar 7 '17 at 0:29

The biggest I can get for now that should fulfill all conditions:

D=10 N=38

Only using the four pieces of the top row (and ordering them exactly like in the top row) we set the following on-states:

Timer1:

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 24

Timer2:

1, 2, 3, 4, 5, 6, 7, 8, 9, 10

Afterwards timer2 is set to off and timer1 will be on for 1 more hour(since they aren't allowed to switch states at the same time)

Next timer1 will be off for 12 hours so timer2 won't move.
Then timer1 will switch on for 12 hours (starting at intervall24) and timer2 will go through 12 hours off-state.

Timer1 will switch off for another 12 hours.
Finally timer1 will switch on again, run for 1 hour during intervall24 and starting with intervall1 timer2 will also switch on thereby closing the cycle.

• You may well have figured out how to get the largest D for a cycle longer than 24 hours, well worth a vote. A larger-by-one D is possible with the same configuration by, heh, keeping one of the timers ON nonstop. A yet larger D is indeed possible with a different configuration. Thank you for understanding all the rules (from an application of real timers, incidentally, not contrived) and for playing by them. – humn Jan 27 '16 at 11:04

### Well, I'm afraid to state the obvious, but I can do $D=11$, $N=1$, no extras:

Rig the circuit up like in the first picture:

Set one timer to all on and the other to all on except hours 12 and 24

This obviously works because one timer acts as a wire and the other as a 11-on, 1-off timer with 12-hour period.

I claim that no period of daylight over 11 hours can be done with a non-24 hour cycle.

First, let's look at the possible circuit diagrams up to circuit topology (assuming that the timers are connected to the main circuit at both sockets).

A timer is denoted by this: ▬

The socket is denoted by this (because it's basically four equivalent plugs, we can use double-plug or double-socket wires to fix non-compatibility problems): ┼

The light and the power switch are denoted by this: ╘ ╛

So - the possible diagrams

1
┌─▬─┐
│ ┌▬┘
╘ ╛


Or:

2
┌▬┐
┼▬┼
╘ ╛


Or:

3
┌─▬┼─┐
│ ┌┼▬┘
╘ ╛


Or:

4
┌─▬─┐
┼─┼▬┘
╘ ╛


Or:

5
┌─▬┼─┐
┼─┼┼▬┘
╘ ╛


Let's work backwards. The 5th diagram shows the light being completely on - $D=\infty$, $N=0$ (but I don't think that counts). The directionality of the timer doesn't matter.

The 4th diagram shows the light always on as well - $D=\infty$, $N=0$ (again, I don't think that counts). And again, directionality doesn't matter.

The 3rd diagram shows one timer being bypassed - so the light is dependent on only one timer. This can give us at most $D=11$, $N=1$ (given how we set the non-bypassed timer). If the non-bypassed timer was backwards with respect to the image at the top of this post, it wouldn't reliably be able to turn itself off and the light would be constantly on.

The 2nd diagram shows two timers in parllel - this means that the light will be on with the effect of a single timer - the result of timer A && timer B. This can give us at most $D=11$, $N=1$ (given the net effect of timer A && timer B). If one of the timers was backwards, again, it wouldn't be able to turn itself off and the light would be constantly on.

Finally, we have just one circuit to work with - the one with two timers in series. None of the timers can be backwards because otherwise they couldn't reliably turn themselves on/off and they wouldn't be able to switch out of their initial state-leading to either a one timer problem ($D=11$, $N=1$ best) or a permanently fixed state light.

Assume $D>11$. Then because hours are discrete, $D\ge12$.

First, the two timers each have just one ON period (maybe spanning 24-1) - we will now prove this.

If the light is on during an ON period, the period must be at least 12 hours long. So there can't be two ON periods where the light is on.

So - what is the point of the first timer having an ON period without the light actually being on? To advance the second timer! But if that was the case, we could just tack the length of the 'useless' ON period onto the end of the previous period - this actually reduces or keeps the same the amount of collisions between the first and second timers switching on/off at the same timer.

Since the second timer only operates when the first timer does, the light has to be on for at least part of the time the second timer is in an ON period.

Now, we have $24^2$ possibilities for each timer (starting time $\times$ length of ON period). This gives us $331 776$ possible light combinations, which...
[I do realise this double-counts and is inefficient, but it is a very rough estimate. I think you can reduce this to $24^2\cdot23=13 248$, but I want to keep it simple and also can't be bothered.]

The computer search didn't return any results with $D>11$.

I do realise how the motor works now, so the impossibility proof is for posterity.

• Very efficient circuit graphics! If you reverse a timer or two, as in Third timer's a charm, more layouts are possible. – humn Mar 6 '17 at 17:56
• @humn Congrats on the 10k! I think I've taken into account directionality now, have I made a wrong assumption? – boboquack Mar 6 '17 at 20:25
• You're right in diagram 2 that the second timer cannot turn itself off. But its ability to keep itself on while the first timer is off can make a difference. And your analysis of diagram 1 nicely eliminates a puzzle I won't need to make now. – humn Mar 6 '17 at 20:32
• @humn But how can we make sure the power reverses before the next OFF interval? If it is always on, the light is always on... – boboquack Mar 6 '17 at 20:59
• The way these timers work, if either connection (plug or socket) is powered, the timer advances. However, in order to advance into or proceed through to the "off" state, the plug must be powered. – tmpearce Mar 6 '17 at 21:53