Publications by xi'an
easy Riddler
The riddle of the week is rather standard probability calculus If N points are generated at random places on the perimeter of a circle, what is the probability that you can pick a diameter such that all of those points are on only one side of the newly halved circle? Since it is equivalent to finding the range of N Uniform variates less than ½. ...
933 sym 6 img
an attempt at code golf
Having discovered codegolf on Stack Exchange a few weeks ago, I spotted a few interesting puzzles since then but only got the opportunity at a try over a quiet and rainy weekend (and Robin being on vacation)! The challenge was to write an R code for deciding whether or not a given integer n is congruent or not, when congruent means that it is the...
1783 sym R (334 sym/2 pcs) 2 img
A precursor of ABC-Gibbs
Following our arXival of ABC-Gibbs, Dennis Prangle pointed out to us a 2016 paper by Athanasios Kousathanas, Christoph Leuenberger, Jonas Helfer, Mathieu Quinodoz, Matthieu Foll, and Daniel Wegmann, Likelihood-Free Inference in High-Dimensional Model, published in Genetics, Vol. 203, 893–904 in June 2016. This paper contains a version of ABC Gi...
3020 sym 2 img
riddles on Egyptian fractions and Bernoulli factories
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...
2039 sym 2 img
another attempt at code golf
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 x² with x and n with nx until no square is left (with neighbour defined a...
1246 sym 2 img
Le Monde puzzle [#1104]
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...
1280 sym R (145 sym/1 pcs) 2 img
Le Monde puzzle [#1105]
Another token game as Le Monde mathematical puzzle: Archibald and Beatrix play with a pile of n>100 tokens, sequentially picking m tokens from the pile with m being a prime number [including m=1] or a multiple of 6, the winner taking the last tokens. If Beatrix knows n and proposes to Archibald to start, what is the value of n? Which cannot be ...
1394 sym R (251 sym/1 pcs) 2 img
CRAN does not validate R packages!
A friend called me the other day for advice on how to submit an R package to CRAN along with a proof his method was mathematically sound. I replied with some items of advice taken from my (limited) experience with submitting packages. And with the remark that CRAN would not validate the mathematical contents of the associated package manual. Nor ...
1808 sym 4 img
a non-riddle
Unless I missed a point in the last riddle from the Riddler, there is very little to say about it: Given N ocre balls, N aquamarine balls, and two urns, what is the optimal way to allocate the balls to the urns towards drawing an ocre ball with no urn being empty? Both my reasoning and a two line exploration code led to having one urn with only o...
827 sym R (154 sym/1 pcs)
Gibbs sampling with incompatible conditionals
An interesting question (with no clear motivation) on X validated wondering why a Gibbs sampler produces NAs… Interesting because multi-layered: The attached R code indeed produces NAs because it calls the Negative Binomial Neg(x¹,p) random generator with a zero success parameter, x¹=0, which automatically returns NAs. This can be escaped by...
1627 sym 6 img