Monday, 29 February 2016

optimization - Halve time with two timers


power outlet, 2 timers, light bulb
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 lighting pattern, with the largest possible whole number $n$, beginning when the outlet's power is switched on.


     Light is on for 1/2 hour,$~$ off for $n$ hours,
      on for 1/2 hour,$~$ off for $n$ hours,
      on for 1/2 hour,$~$ off for $n$ 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


Related puzzles
Odd hours with two timers
Day and night of the two timers
Third timer's a charm


(These puzzles are either directly from or related to actual botany experiments)




Answer



To show that Ivo Beckers has the longest $n$ in his answer, rewrite it like this:



Set the intervals like this where 1 is on and 0 is off:
A: 101101101101101101101101
B: 101010101010101010101010


set dial A to 30 minutes and B to 0 minutes.



That is, rotate A once to the left and set its timer to 30 instead of 90.


This works as before for a one hour delay.



Notice that A is now simply 101 repeated 8 times.


To get a 2 hour delay we'd need A to be 10010 repeated, but 5 doesn't divide 24 evenly.


Likewise, for a 3 hour delay A is set to 1000100 repeated but 7 doesn't divide 24 evenly.


etc


None of these work because:
Their length is len = n + (n + 1) for an n hour delay.
Let's call this len(A), therefore len(A) has to be odd.
The only odd number that divides 24 evenly is 3.


So 1 hour is the longest delay.


EDIT: Other patterns simply don't work.



In order to have a 1/2 hour on followed by off B can't have any sequential ones.


So B must be composed of a single one followed by one or more zeros with this pattern repeated through out B.


B must also start with a one or we can simply remove leading zeros (with no loss of generality) so that B does start with a one.


A must now start with a one and its timer set to start at 30 minutes so we begin with a 1/2 hour on.


A must then be followed by a zero so we go off after that 1/2 hour on.


And B obviously is followed by one or more zeros.


Therefore A and B must start with:


A = 10 [1]
B = 10 [2]


Now for any number of zeros that follow the initial one for B in [2], say B is now 10...0 repeated i.e a one followed by b zeros followed by a one followed by b zeros etc, then A must be 100..011..1 repeated i.e. a one followed by b zeros and then b ones followed by a one then b zeros, then b ones etc.



Therefore len(A) is 1 + 2b, so len(A) remains odd and must evenly divided 24.


So therefore len(A) can only equal 3.
and A is 101101101101101101101101
and B is 101010101010101010101010
with A starting at 30 minutes and B at 0 minutes.
Or equivalent rotations as in Ivo Beckers original answer.


No comments:

Post a Comment

Understanding Stagnation point in pitot fluid

What is stagnation point in fluid mechanics. At the open end of the pitot tube the velocity of the fluid becomes zero.But that should result...