Archive for Le Monde

Le Monde puzzle [#1159]

Posted in Books, Kids, R with tags , , , , , , on October 6, 2020 by xi'an

The weekly puzzle from Le Monde is quite similar to #1157:

Is it possible to break the ten first integers, 1,…,10, into two groups such that the sum over the first group is equal to the product over the second? Is it possible that the second group is of cardinal 4? of cardinal 3?

An exhaustive R search returns 3 solutions by

for (i in 1:2^10)
  if (sum(d[!!bitz(i)])==prod(b<-d[!bitz(i)])) print(b)
[1]  1  4 10 #40
[1] 6 7 #42
[1] 1 2 3 7 #42

which brings a positive reply to the question. Moving from N=10 to N=19 produces similar results

[1]  1  9 18 #162
[1]  2  6 14 #168
[1]  1  3  4 14 #168
[1]  1  2  7 12 #168

with this interesting pattern of only two acceptable products, but I am obviously unable to run the same code for N=49, which is the subsidiary question to the puzzle. Turning to a more conceptual (!) approach, over a long insomnia bout (!!) and a subsequent run, I realised that if there are three terms, x¹,x² and x³, in the second group, they need satisfy


and if in addition one of them is equal to 1, x¹ say, this equation simplifies into


which always leads to a solution, as e.g. for N=49,

x¹=1, x²=24 and x³=48.

A brute-force search also led to a four term solution in that case

x¹=1, x²=7, x³=10 and x⁴=17.

abortion data, France vs. USA

Posted in Kids, Statistics, Travel with tags , , , , , , , , , , , on October 5, 2020 by xi'an

As Le Monde pointed out at a recent report on 2019 abortions in France from Direction de la recherche, des études, de l’évaluation et des statistiques (Drees), showing an consistent rise in the number of abortions in France since 1995, with a rate of 15.6 abortions for 1000 women and the number around a third of the live births that year, I started wondering at the corresponding figures in the USA, given the much more restrictive conditions there. Judging from this on-line report by the Guttmacher Institute, the overall 2017 figures are not so different in both countries: while the abortion rate fell to 13.5‰, and the abortion/life birth ratio to 22%, the recent spike in abortion restrictions for most US States did not seem to impact considerably the rates, even though this is a nationwide average, hiding state disparities (like a 35% drop in Iowa or Alabama [and a 62% drop in Delaware, despite no change in the number of clinics or in the legislation]). In addition, France did not apparently made conditions more difficult recently (most abortions occur locally and the abortion rate is inversely correlated with income) and French (official) figures include off-clinic drug-induced abortions, while the Guttmacher institute census does not. The incoming (hasty) replacement of Judge Ruth Bader Ginsberg in the US Supreme Court may alas induce a dramatic turn in these figures if a clear anti-abortion majority emerges…

Le Monde puzzle [#1157]

Posted in Books, Kids, R with tags , , , , , , on October 1, 2020 by xi'an

The weekly puzzle from Le Monde is an empty (?) challenge:

Kimmernaq and Aputsiaq play a game where Kimmernaq picks ten different integers between 1 and 100, and Aputsiaq must find a partition of these integers into two groups with identical sums. Who is winning?

Indeed, if the sums are equal, then the sum of their sums is even, meaning the sum of the ten integers is even. Any choice of these integers such that the sum is odd is a sure win for Kimmernaq. End of the lame game (if I understood its wording correctly!). If some integers can be left out of the groups, then both solutions seem possible: calling the R code

while (P<M){
t=sample(1:7,1)     #size of subset
o=1         #total sum must be even

I found no solution (i.e. exiting the outer while loop) for M not too large…  So Aputsiaq is apparently winning. Le Monde solution considers the 2¹⁰-1=1023 possible sums made out of 10 integers, which cannot exceed 955, hence some of these sums must be equal (and the same applies when removing the common terms from both sums!). When considering the second half of the question

What if Kimmernaq picks 6 distinct integers between 1 and 40, and Aputsiaq must find a partition of these integers into two groups with identical sums. Who is winning?

recycling the above R code produced subsets systematically hitting the upper bound M, for much larger values. So Kimmernaq should have a mean to pick 6 integers such that any subgroup cannot be broken into two parts with identical sums. One of the outcomes being

> a
[1] 36 38 30 18  1 22

one can check that all the possible sums differ:

for(i in 2:5){

and the outcome is indeed of length 2⁶-2=62!

As an aside, a strange [to me at least] R “mistake” was that when recycling the variable F in a code-golfing spirit, since it is equal to zero by default, rather than defining a new Q:


the counter P was not getting updated!

Le Monde puzzle [#1155]

Posted in Books, Kids, R with tags , , , , , , , on September 26, 2020 by xi'an

The weekly puzzle from Le Monde is another Sudoku challenge:

Anahera and Wiremu play a game for T rounds. They successively pick a digit between 1 and 3, never repeating the previous one, and sum these digits. The last to play wins if the sum is a multiple of 3. Who is the winner for an optimal strategy?

By a simple dynamic programming of the optimal strategy at each step

for (T in 2:20)
for (i in 1:N) A[T,i]=i+ifelse(!T%%2, #parity check
max((i+A[T-1,-i])%%3), #avoid zero
min((i+A[T-1,-i])%%3)) #seek zero

the first to play can always win the game. Not fun!

pooling or not pooling

Posted in Books, Kids, pictures, Statistics, University life with tags , , , , , , , , , , on September 22, 2020 by xi'an

A pro-pooling opinion tribune, followed a few days later, by a collection of opinions on pooling PCR samples to absorb the overload in testing laboratories and produce results in a delay that is short enough for public health impacts.  Le Monde is taking sample pooling most seriously! This includes a link to an April article by Christian Grollier and Olivier Gossner (CREST) published in COVID economics (!), recalling the basics of sample pooling and citing a Technion experiment to show the approach is feasible in practice. With a recommended pool of 80 patients if the prevalence is 2%. And of 30 for a prevalence of 5%. Despite the approach being implemented in other countries, and considerable delays in analysing the PCR samples, the conclusion of the French public health authorities is that it is urgent to wait..!