Le Monde puzzle [#1149]

[This article was first published on R – Xi’an’s Og, and kindly contributed to R-bloggers]. (You possibly can report concern in regards to the content material on this web page right here)


Wish to share your content material on R-bloggers? click on right here when you’ve got a weblog, or right here should you do not.

The weekly puzzle from Le Monde is a leaking variant on an outdated puzzle:

Three buckets have capacities of 8, 5 and three litres, respectively. At first of the sport, the Eight litre bucket is full and each others are empty. Aiming at reaching precisely four litres in a single bucket, water is transferred between buckets. Nevertheless, a fraction 1/okay is misplaced with every switch. If okay=9, it’s doable to achieve four litres in three operations? If okay=7, is it in any respect doable to achieve four litres?

By sheer random search

okay=1/5
z=c(8,5,3)
m<-function(s){ i=pattern(1:3,2) s[i]=s[i]+ifelse( rep((a<-z[i[1]]-s[i[1]])<(b<-s[i[2]])*(1-k),2), a*c(1,-1-k),b*c(1-k,-1)) s}

I discovered that almost all fractions permit to achieve four litres beginning with okay=2. (And am not sure the lacking ones, like 18 or 21 should not resulting from a scarcity of luck… Specifically, for okay=9, the shortest path is

 8.000 Zero Zero 2.375 5 Zero 0.000 5 2.11 0.000 four 3

Leave a Reply

Your email address will not be published. Required fields are marked *