Le Monde puzzle [#827]

Back to R (!) for the current Le Monde puzzle:

Given an unknown permutation of the set {1,…,6}, written on the faces of a cube, there exist a sequence of summits such that increasing by one unit the three numbers of the faces sharing the successive summits in the sequence leads to identical values over all faces. What was the initial permutation? What is the minimal number of steps to reach equality?

My initial worry was to rewrite the summit constraint(s) in a manageable way. I tried with a 6×8 matrix, calling 1 the bottom face and 6 the top face (which are thus the only two that cannot get changed at the same time):

for (i in 2:5){

First, I sought a random exploration of the faces. However, I did impose the smallest and largest values on the top and  bottom faces as they are the ones getting most and least updated compared with the other faces (?):

for (alea in 1:10^3){
for (T in 1:100){
   if (diff(range(faces))==0) break()
if (diff(range(faces))==0){

The outcome is unsurprising in that the smallest number of summits is then 5, making all faces equal to 6. For a starting value equal to, e.g., {1,2,3,5,4,6}. (Something that tooks a [wee] while for me to understand was why removing the sample(2:5) in the above makes a difference.) The solution in Le Monde spells out the solution more clearly as a cube whose opposite faces should sum up to 7…

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 )

Connecting to %s

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

%d bloggers like this: