Le Monde puzzle [#1010]

An arithmetic Le Monde mathematical puzzle (or two independent ones, again!):

  1. Take the integers from 1 to 19, pick two of them with identical parity at random and replace the pair with their average. Repeat 17 times to obtain a single integer. What are the values between 1 and 19 that cannot be achieved?
  2.  Take the integers from 1 to 19, pick four of them at random so that the average is an integer and replace the quadruplet with their average. Repeat 5 times to obtain a single integer. What are the values between 1 and 19 that can be achieved?

The first question seems pretty open to brute force simulation. Here is an R code I wrote

numbz=1:M
for (t in 2:M){
 numbz=sample(numbz);count=0
 while((count<100)&(sum(numbz[1:2])%%2>0)){
   numbz=sample(numbz);count=count+1}
if (count==100) break()
 numbz[1]=as.integer(mean(numbz[1:2]))
 numbz=numbz[-2]}

with the stopping rule resulting from the fact that the remaining two digits may sometimes be of opposite parity (a possibility omitted in the wording of the puzzle, along with a mistake in the number of repetitions). However, the outcome of this random exploration misses the extreme possible values. For instance, 10⁶ attempts produce the range

4 5 6 7 8 9 10 11 12 13 14 15 16 17

while the extremes should be 2 and 18 according to this scratch computation:

which appears to have too low a probability of occurring for being part of the 10⁶ instances. Running the code a mere (!) 10⁷ iterations managed to reach 3 as well. (Interestingly, the above sequence uses 2 the most and 19 the least, but weights 19 the most and 2 the least!)

The second puzzle is also open to random exploration with a very similar R code:

utcome=NULL
for (z in 1:1e6){
numbz=1:19
for (t in 1:6){
  numbz=sample(numbz);count=0
  while ((sum(numbz[1:4])%%4>0)&(count<100)){
    numbz=sample(numbz);count=count+1}
  if (count==100) break()
  numbz[1]=as.integer(mean(numbz[1:4]))
  numbz=numbz[-(2:4)]}
if (count<100) utcome=c(utcome,numbz)}

returning the values

4 7 10 13 16

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s