Le Monde puzzle [#4]
A fairly simple puzzle in this weekend Le Monde magazine: given five points on a line such that their pairwise distances are 1,2,4,…,14,18,20, find the respective positions of the five points over the line and deduce the missing distances. Without loss of generality, we can set the first point at 0 and the fifth point at 20. The three remaining points are in between 1 and 19, but again without loss of generality we can choose the fourth point to be at 18. (Else the second point would be at 2.) Finding the three remaining points can be done by the R code
i=1 while (i==1){ prop=sort(c(0,sample(1:17,2),18,20)) a=sort(dist(prop)) if ((a[1]==1)&&(a[2]==2)&&(a[3]==4)&&(a[8]==14)) break() }
Removing 18 from the above takes about the same time! A solution (modulo permutations) is 0, 13, 14, 18, 20.
December 26, 2014 at 6:39 am
[…] is the source of the problem and an algorithm with R which I used for […]
February 11, 2011 at 12:15 am
[…] Sudoku-like puzzle from the weekend edition of Le Monde. The object it starts with is a 9×9 table where each entry is an integer and where neighbours […]
February 5, 2011 at 11:04 am
I posted the problem and another solution on SE: http://goo.gl/3aTmY
February 4, 2011 at 8:47 pm
Cool!
“while (TRUE)” works too, right?
February 5, 2011 at 6:32 am
Yes indeed. And certainly more elegant.
February 4, 2011 at 9:50 am
And the symmetric: 0 2 6 7 20.
February 12, 2011 at 6:39 pm
Good point!)
February 13, 2011 at 2:12 pm
Yes this was my meaning of “permutation” but symmetry would have been clearer!!!