Le Monde puzzle [#737]

August 26, 2011

(This article was first published on Xi'an's Og » R, and kindly contributed to R-bloggers)

The puzzle in the weekend edition of Le Monde this week can be expressed as follows:

Consider four integer sequences (xn), (yn), (zn), and (wn), such that

x_0=0 < y_0 < z_0 < w_0 <48

and, if u=(xn,yn,zn,wn), for i=1,…,4,


if ui is not the maximum of u and

u_{i}=\frac{1}{2}\left(u_{i}+48+\min_{j\ne i}u_{j}\right)\,\text{mod}\,48

otherwise. Find the first return time n (if any) such that xn=0. Find the value of (y0,z0,w0) that minimises this return time.

The difficulty stands with the constraint that the sequences only take integer values, which eliminates a lot of starting values. I wrote an R code that corresponds to this puzzle:

while (nodd){

plot(clock[1,],clock[2,],type="l", axes=F,xlab="",ylab="")

for (t in 1:10^5){

  for (j in 1:4){

   if (suite[j]<max(suite)){

  plot(clock[1,],clock[2,],type="l", axes=F,xlab="",ylab="")
  for (j in 1:4)

  if ((suite[1]==0)||(max(is.decimal(suite))==1)){

but it fails to produce a result, always bumping into unacceptable starting values after one or two (rarely three) iterations! So either the starting conditions are very special out of the 23*22*21/6=1771 possible values of sort(2*sample(1:23,3)) or…I missed a point in the original puzzle.

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , ,

Comments are closed.


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)