Here you will find daily news and tutorials about R, contributed by over 573 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

The puzzle in Le Monde this weekend is not that clear (for a change!), so I may be confused in the following exposition:

Three card players are betting with a certain (and different) number of chips each, between 4 and 9. After each game, the looser doubles the number of chips of the winner (while the second keeps her chips). The game stops if the looser cannot pay the winner. Find the initial configuration such that, at some point in the party, all players have the same number of chips.

So, if (x_{1},x_{2},x_{3}) is the chip configuration at time t for the ordered players, (2x_{1},x_{2},x_{3}-x_{1}) is the chip configuration at time (t+1). Rather than running an exhaustive search, given the limited number of possibilities, I decided to search at random, ending up with the R function

lemonde=function(chip,chap){
x=rep(-1,3)
while (min(x)<0){
start=x=sample(chip:chap,3)
while (length(unique(start))==1)
start=x=sample(chip:chap,3)
while ((min(x)>-1)&&(length(unique(x))>1)){
x=sample(x) #random winner
x=c(2*x[1],x[2],x[3]-x[1])
}}
list(start=sort(start),finish=x)
}

leading to

> lemonde(4,9)
$start
[1] 7 8 9
$finish
[1] 8 8 8

with a unique starting point. More interestingly, other configurations may have several starting points. Of course, a mathematical analysis of the problem would bring more light on the difference. Maybe the issue of Le Monde next weekend (i.e., tonight!) will be enough.