Le Monde puzzle [34]

Since the puzzle in this week (-end) edition of Le Monde is not (easily) solvable via an R program, I chose to go back to an older puzzle that my students can solve.

Eleven [distinguishable] token are [arbitrarily] distributed around a 200 meter perimeter-long ring. They all start moving at the same speed, 18km/h, in arbitrary directions. When two tokens hit one another they instantaneously reverse directions while keeping the same absolute speed. How long does it take for all tokens to be back in their initial positions?

The logical [non-computational] solution was given in an earlier edition: If all tokens move in the same direction, it takes 60×60/(18×5)=40 seconds to complete a turn and hence to see all tokens back to their initial positions. If they are moving into different directions, hits have no impact on the distribution of the tokens when they are not distinguished. Therefore, after 40 seconds, the repartition of the tokens is the same as at time 0, except for a permutation of the individual tokens. Given that there are 11 tokens, it takes at most 11 permutations to see all tokens back to their initial positions, i.e. 440 seconds. Here is the basic R resolution with a dynamic rendering of the moving tokens. It obviously gives 440 seconds as its output.

# warning: plotting takes much more time
for (i in (1:10))
for (j in ((i+1):11))
     if (tokens[i]==tokens[j]) speeds[c(i,j)]=-speeds[c(i,j)]
while (sum(abs(tokens-start))>0){
  for (i in (1:10))
  for (j in ((i+1):11))
     if (tokens[i]==tokens[j]) speeds[c(i,j)]=-speeds[c(i,j)]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.