Le Monde puzzle [#1076]

Posted in Books, Kids, R, Travel with tags , , , , , , , , , on December 27, 2018 by xi'an

A cheezy Le Monde mathematical puzzle : (which took me much longer to find [in the sense of locating] than to solve, as Warwick U does not get a daily delivery of the newspaper [and this is pre-Brexit!]):

Take a round pizza (or a wheel of Gruyère) cut into seven identical slices and turn one slice upside down. If the only possibly moves are to turn three connected slices to their reverse side, how many moves at least are needed to recover the original configuration? What is the starting configuration that requires the largest number of moves?

Since there are ony N=2⁷ possible configurations, a brute force exploration is achievable, starting from the perfect configuration requiring zero move and adding all configurations found by one additional move at a time… Until all configurations have been visited and all associated numbers of steps are stable. Here is my R implementation

```nztr=lengz=rep(-1,N) #length & ancestor
nztr[0+1]=lengz[0+1]=0
fundz=matrix(0,Z,Z) #Z=7
for (i in 1:Z){ #only possible moves
fundz[i,c(i,(i+1)%%Z+Z*(i==(Z-1)),(i+2)%%Z+Z*(i==(Z-2)))]=1
lengz[bit2int(fundz[i,])+1]=1
nztr[bit2int(fundz[i,])+1]=0}
while (min(lengz)==-1){ #second loop omitted
for (j in (1:N)[lengz>-1])
for (k in 1:Z){
m=bit2int((int2bit(j-1)+fundz[k,])%%2)+1
if ((lengz[m]==-1)|(lengz[m]>lengz[j]+1)){
lengz[m]=lengz[j]+1;nztr[m]=j}
}}
```

Which produces a path of length five returning (1,0,0,0,0,0,0) to the original state:

```> nztry(2)
[1] 1 0 0 0 0 0 0
[1] 0 1 1 0 0 0 0
[1] 0 1 0 1 1 0 0
[1] 0 1 0 0 0 1 0
[1] 1 1 0 0 0 0 1
[1] 0 0 0 0 0 0 0
```

and a path of length seven in the worst case:

```> nztry(2^7)
[1] 1 1 1 1 1 1 1
[1] 1 1 1 1 0 0 0
[1] 1 0 0 0 0 0 0
[1] 0 1 1 0 0 0 0
[1] 0 1 0 1 1 0 0
[1] 0 1 0 0 0 1 0
[1] 1 1 0 0 0 0 1
[1] 0 0 0 0 0 0 0
```

Since the R code was written for an arbitrary number Z of slices, I checked that there is no solution for Z being a multiple of 3.

off to Florida

Posted in Books, Kids, Running, Statistics, Travel, University life, Wines with tags , , , , , , , , , , on January 17, 2013 by xi'an

Today I am off (again!) to Florida, taking part in the Winter Workshop at the University of Florida, Gainesville. The theme this year is New Directions in Monte Carlo Methods. I am quite excited to meet again with many old friends (this almost sounds like a rehearsal for MCMSki 4!), but also sad that George Casella who would have been my oldest friend there will be missing. Dearly missing and missed. At the same time, I appreciate that this workshop gives me the opportunity to meet at last with George’s family (with whom I share so many memories) and his colleagues at UFL. I am sure we will have plenty of pizzas, wine(s), and laughs in remembrance of the numerous good times we all had with George. And I will run the streets we ran together, quite a while ago…

On a dreary evening…

Posted in Kids with tags , , , , , , on March 5, 2011 by xi'an

My daughter wrote the following funny and absurd to-do-list during a particularly dreary evening:

When you do not know what to do on a dreary evening you can

• Raise a tent inside your bedroom,
• Start a pillow-fight with the mirror,
• Build a rubber duck in another material,
• Get the breakfast table ready for the next morning,
• Set all alarm-clocks in the house to 4am,
• Train for a new signature on several rolls of toilet paper,
• Order a pizza for the neighbours that are already asleep,
• Write your memoirs in a book entitled Moi,
• Sort fruits and vegetables by colour,then by size,
• Evaluate the average filling time of a sand-glass,
• Classify the spider webs in the house,
• Build a temporary bed out of one’s books,
• Paint one’s bedroom in fluorescent paint that forces monsters away,
• Hide chocolate eggs all over the house for the next morning,
• Shoe-shine others’ slippers,
• Build a temporary bed with eight Kapla boxes,
• Store letters cut in magazines in preparation for anonymous letters,