## Le Monde puzzle [#1104]

Posted in Kids, R with tags , , , , on June 18, 2019 by xi'an

A palindromic Le Monde mathematical puzzle:

In a monetary system where all palindromic amounts between 1 and 10⁸ have a coin, find the numbers less than 10³ that cannot be paid with less than three coins. Find if 20,191,104 can be paid with two coins. Similarly, find if 11,042,019 can be paid with two or three coins.

Which can be solved in a few lines of R code:

coin=sort(c(1:9,(1:9)*11,outer(1:9*101,(0:9)*10,"+")))
amounz=sort(unique(c(coin,as.vector(outer(coin,coin,"+")))))
amounz=amounz[amounz<1e3]


and produces 9 amounts that cannot be paid with one or two coins.

21 32 43 54 65 76 87 98 201

It is also easy to check that three coins are enough to cover all amounts below 10³. For the second question, starting with n¹=20,188,102,  a simple downward search of palindromic pairs (n¹,n²) such that n¹+n²=20,188,102 led to n¹=16,755,761 and n²=3,435,343. And starting with 11,033,011, the same search does not produce any solution, while there are three coins such that n¹+n²+n³=11,042,019, for instance n¹=11,022,011, n²=20,002, and n³=6.

## off to Abidjan, with a few Annals [62kg of ’em]

Posted in Books, Kids, Statistics, Travel, University life with tags , , , , , , , , on June 16, 2019 by xi'an

## unknown pleasures [40 years ago]

Posted in Kids, pictures with tags , , , , on June 15, 2019 by xi'an

## another attempt at code golf

Posted in Books, Kids, R with tags , , , on June 12, 2019 by xi'an

I had another lazy weekend go at code golf, trying to code in the most condensed way the following task. Provided with a square matrix A of positive integers, keep iterating the steps

• take the highest square $$𝑥²$$ in A.
• find the smallest adjacent neighbour $$𝑛$$
• replace with x and n with nx

until no square is left (with neighbour defined as either horizontally or vertically and without wrapping around). While I managed a 217 bytes solution, compared with Robin’s 179b improvement, which remains surprising readable!, the puzzle offers two further questions:

1. is there a non-iterative way to find the final matrix B?
2. the puzzle assumes that A satisfies that at each step, the highest square and the smallest neighbour n will be unique, and that the sequence will not repeat forever. Is there a fool-proof way to check this is the case?

## riddles on Egyptian fractions and Bernoulli factories

Posted in Books, Kids, R with tags , , , , , , , , , , , , , on June 11, 2019 by xi'an

Two fairy different riddles on the weekend Riddler. The first one is (in fine) about Egyptian fractions: I understand the first one as

Find the Egyptian fraction decomposition of 2 into 11 distinct unit fractions that maximises the smallest fraction.

And which I cannot solve despite perusing this amazing webpage on Egyptian fractions and making some attempts at brute force  random exploration. Using Fibonacci’s greedy algorithm. I managed to find such decompositions

2 = 1 +1/2 +1/6 +1/12 +1/16 +1/20 +1/24 +1/30 +1/42 +1/48 +1/56

after seeing in this short note

2 = 1 +1/3 +1/5 +1/7 +1/9 +1/42 +1/15 +1/18 +1/30 +1/45 +1/90

And then Robin came with the following:

2 = 1 +1/4 +1/5 +1/8 +1/10 +1/12 +1/15 +1/20 +1/21 +1/24 +1/28

which may prove to be the winner! But there is even better:

2 = 1 +1/5 +1/6 +1/8 +1/9 +1/10 +1/12 +1/15 +1/18 +1/20 +1/24

The second riddle is a more straightforward Bernoulli factory problem:

Given a coin with a free-to-choose probability p of head, design an experiment with a fixed number k of draws that returns three outcomes with equal probabilities.

For which I tried a brute-force search of all possible 3-partitions of the 2-to-the-k events for a range of values of p from .01 to .5 and for k equal to 3,4,… But never getting an exact balance between the three groups. Reading later the solution on the Riddler, I saw that there was an exact solution for 4 draws when

$p=\frac{3-\sqrt{3(4\sqrt{9}-6)}}{6}$

Augmenting the precision of my solver (by multiplying all terms by 100), I indeed found a difference of

> solver((3-sqrt(3*(4*sqrt(6)-9)))/6,ba=1e5)[1]
[1] 8.940697e-08

which means an error of 9 x 100⁻⁴ x 10⁻⁸, ie roughly 10⁻¹⁵.

## the Kouign-Amann experiment

Posted in Kids, Travel, pictures with tags , , , , , , , on June 10, 2019 by xi'an

Having found a recipe for Kouign-Amanns, these excessive cookies from Britanny that are essentially cooked salted butter!, I had a first try that ended up in disaster (including a deep cut on the remaining thumb) and a second try that went better as both food and body parts are concerned. (The name means cake of butter in Breton.)The underlying dough is pretty standard up to the moment it starts being profusedly buttered and layered, again and again, until it becomes sufficiently feuilleté to put in the oven. The buttery nature of the product, clearly visibly on the first picture, implies the cookies must be kept in containers like these muffin pans to preserve its shape and keep the boiling butter from  inundating the oven, two aspects I had not forecasted on the first attempt.The other if minor drawback of these cookies is that they do not keep well as they contain so much butter. Bringing enough calories input for an hearty breakfast (and reminding me of those I ate in Cambridge while last visiting Pierre).

## Lawrence D. Brown PhD Student Award

Posted in Kids, Statistics, Travel, University life with tags , , , , , , on June 3, 2019 by xi'an

[Reproduced from the IMS Bulletin, an announcement of a travel award for PhD students in celebration of my friend Larry Brown!]

Lawrence D. Brown (1940-2018), Miers Busch Professor and Professor of Statistics at The Wharton School, University of Pennsylvania, had a distinguished academic career with groundbreaking contributions to a range of fields in theoretical and applied statistics. He was an IMS Fellow, IMS Wald Lecturer, and a former IMS President. Moreover, he was an enthusiastic and dedicated mentor to many graduate students. In 2011, he was recognized for these efforts as a recipient of the Provost’s Award for Distinguished PhD Teaching and Mentoring at the University of Pennsylvania.

Brown’s firm dedication to all three pillars of academia — research, teaching and service — sets an exemplary model for generations of new statisticians. Therefore, the IMS is introducing a new award for PhD students created in his honor: the IMS Lawrence D. Brown PhD Student Award.

This annual travel award will be given to three PhD students, who will present their research at a special invited session during the IMS Annual Meeting. The submission process is now open and applications are due by July 15th, 2019 for the 2020 award. More details, including eligibility and application requirements, can be found at: https://www.imstat.org/ims-awards/ims-lawrence-d-brown-ph-d-student-award/

Donations are welcome as well, through https://www.imstat.org/contribute-to-the-ims/ under “IMS Lawrence D. Brown Ph.D. Student Award Fund”