Le Monde puzzle [#835]

September 28, 2013

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

The current puzzle is apparently suffering from combinatoric complexity :

N persons (with 20≤N≤23) are sitting around a round table and everyone has a green or red token. Both colours are represented. First, each player with a red token take the token of the player immediately to her or his left. Second, each player with at least one green token gives it to the player next to the player immediately to her or his left. By that time, everyone has a token in front of her or him. What are the possible values of N?

I first tried a brute force approach where I fill a table at random and apply the rules:

while (!sole){
#Move 1
#Move 2

After a rather long while that had me fear the loop had became “infinite”, this R code produced a (non-trivial) result:

> arthur[,1]
 [1] 2 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2 1 2

which shows that for N=21 and two green (2) tokens following a red (1) token, the procedure returns a configuration where all players have one and only one token. (Of course, the R code does not exclude the extreme case when all tokens are from a single colour.) From there, the generic solution follows: N must be a multiple of 3 and the tokens must be set as red-green-green-red-green-green-…

Filed under: Books, Kids, 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...

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)