Le Monde puzzle [#739]
The weekend puzzle in Le Monde this week is again about a clock. Now, the clock has one hand and x ticks where a lamp is either on or off. The hand moves from tick to tick and each time the lights go on or off depending on whether or not both neighbours were in the same state the previous time. Here is my R code that describes the evolution of the clock according to this rule:
library(animation) ani.options(interval=1) plotstate=function(t,state){ ticks=length(state) plot(c(0,sin(t*2*pi/ticks)), c(0,cos(t*2*pi/ticks)),type="l",col="tomato", xlim=c(-1.2,1.2),ylim=c(-1.2,1.2),axes=FALSE,xlab="",ylab="") on=(1:ticks)[state==1]*2*pi/ticks points(cos(on),sin(on),col="gold",cex=2,pch=19) on=(1:ticks)[state==0]*2*pi/ticks points(cos(on),sin(on),col="sienna",cex=2,pch=19) ani.pause() } ticks=12 states=as.integer((runif(ticks)<.5)) plotstate(t=0,states) for (t in 1:ticks){ states=1-((states[c(2:ticks,1)]- states[c(ticks,1:(ticks-1))])==0) plotstate(t,states) }
Given the initial state (0,1,0,1,1,0,0,0,1,0,0,1), the question is to provide the state after one hour
> states [1] 0 0 0 1 1 1 0 0 1 1 0 1
The next question is rather unclear: with a different number of ticks, is it possible to forecast the state of the clock one hour later? My answer is to run the R code with the appropriate value for ticks and observe the result, since the update rule is deterministic. For instance, here is the result for 18 ticks:
But I am sure this is not what the authors of Le Monde puzzle meant…
September 9, 2011 at 7:16 pm
Le Monde weekend edition proposes a solution based on the above update against the neighbours to deduce how many steps are necessary to produce a cycle: with 12 ticks/lamps, the cycle is of length 4, with 5 ticks of length 3, &tc. Once again the question was not precisely stated!