Le Monde puzzle [#739]

[This article was first published on Xi'an's Og » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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:

  plot(c(0,sin(t*2*pi/ticks)), c(0,cos(t*2*pi/ticks)),type="l",col="tomato",


for (t in 1:ticks){

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…

Filed under: R Tagged: Le Monde, mathematical puzzle, R

To leave a comment for the author, please follow the link and comment on their blog: Xi'an's Og » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)