Archive for Diophantine equations

Le Monde puzzle [#1164]

Posted in Books, Kids, R with tags , , , , , , , , , , , , , on November 16, 2020 by xi'an

The weekly puzzle from Le Monde is quite similar to older Diophantine episodes (I find myself impossible to point out):

Give the maximum integer that cannot be written as 105x+30y+14z. Same question for 105x+70y+42z+30w.

These are indeed Diophantine equations and the existence of a solution is linked with Bézout’s Lemma. Take the first equation. Since 105 and 30 have a greatest common divisor equal to 3×5=15, there exists a pair (x⁰,y⁰) such that

105 x⁰ + 30 y⁰ = 15

hence a solution to every equation of the form

105 x + 30 y = 15 a

for any relative integer a. Similarly, since 14 and 15 are co-prime,

there exists a pair (a⁰,b⁰) such that

15 a⁰ + 14 b⁰ = 1

hence a solution to every equation of the form

15 a⁰ + 14 b⁰ = c

for every relative integer c. Meaning 105x+30y+14z=c can be solved in all cases. The same result applies to the second equation. Since algorithms for Bézout’s decomposition are readily available, there is little point in writing an R code..! However, the original question must impose the coefficients to be positive, which of course kills the Bézout’s identity argument. Stack Exchange provides the answer as the linear Diophantine problem of Frobenius! While there is no universal solution for three and more base integers, Mathematica enjoys a FrobeniusNumber solver. Producing 271 and 383 as the largest non-representable integers. Also found by my R code

o=function(i,e,x){
  if((a<-sum(!!i))==sum(!!e))sol=(sum(i*e)==x) else{sol=0
    for(j in 0:(x/e[a+1]))sol=max(sol,o(c(i,j),e,x))}
  sol}
a=(min(e)-1)*(max(e)-1)#upper bound
M=b=((l<-length(e)-1)*prod(e))^(1/l)-sum(e)#lower bound
for(x in a:b){sol=0
for(i in 0:(x/e[1]))sol=max(sol,o(i,e,x))
M=max(M,x*!sol)}

(And this led me to recover the earlier ‘Og entry on the coin problem! As of last November.) The published solution does not bring any useful light as to why 383 is the solution, except for demonstrating that 383 is non-representable and any larger integer is representable.

Big Bayes goes South

Posted in Books, Mountains, pictures, Running, Statistics, Travel, University life with tags , , , , , , , , , , , , , , , , , , , , , , on December 5, 2018 by xi'an

At the Big [Data] Bayes conference this week [which I found quite exciting despite a few last minute cancellations by speakers] there were a lot of clustering talks including the ones by Amy Herring (Duke), using a notion of centering that should soon appear on arXiv. By Peter Müller (UT, Austin) towards handling large datasets. Based on a predictive recursion that takes one value at a time, unsurprisingly similar to the update of Dirichlet process mixtures. (Inspired by a 1998 paper by Michael Newton and co-authors.) The recursion doubles in size at each observation, requiring culling of negligible components. Order matters? Links with Malsiner-Walli et al. (2017) mixtures of mixtures. Also talks by Antonio Lijoi and Igor Pruenster (Boconni Milano) on completely random measures that are used in creating clusters. And by Sylvia Frühwirth-Schnatter (WU Wien) on creating clusters for the Austrian labor market of the impact of company closure. And by Gregor Kastner (WU Wien) on multivariate factor stochastic models, with a video of a large covariance matrix evolving over time and catching economic crises. And by David Dunson (Duke) on distance clustering. Reflecting like myself on the definitely ill-defined nature of the [clustering] object. As the sample size increases, spurious clusters appear. (Which reminded me of a disagreement I had had with David McKay at an ICMS conference on mixtures twenty years ago.) Making me realise I missed the recent JASA paper by Miller and Dunson on that perspective.

Some further snapshots (with short comments visible by hovering on the picture) of a very high quality meeting [says one of the organisers!]. Following suggestions from several participants, it would be great to hold another meeting at CIRM in a near future. Continue reading

Le Monde puzzle [#1063] and le bac’

Posted in Kids with tags , , , on August 21, 2018 by xi'an

As pointed out by Jean-Louis Foulley in his comment on the recent Le Monde puzzle [#1063] post, the questions are heavily inspired by the 2018 high school final exam (known as Le Baccalauréat or Le Bac’) in mathematics in France, as can be checked from the above. Including the denomination of powerful number! In Part A, the students had to study the Diophantine equation x²-8y²=1 (E) and show it had an infinite number of (integer) solutions. While these students did not have access to computing facilities, question 1 was solved by sheer enumeration, providing 8=2³ and 9=3² as an answer. While (2) and (3) are rather straightforward, using the prime number decomposition of a and b for (2), the fact that x² and 8y² are powerful for (3). Brute force search leading to x=99,y=35 for the final question.

Le Monde puzzle [#814]

Posted in Books, Kids, R with tags , , , on April 2, 2013 by xi'an

The #814 Le Monde math puzzle was to find 100 digits (between 1 and 10) such that their sum is equal to their product. Given the ten possible values of those digits, this is equivalent to finding integers a1,…,a10 such that

a1+…+a10=100

and

a1+2a2+…+10a10=2a2x….x10a10,

which reduces the number of unknowns from 100 to 10 (or even 9). Furthermore, the fact that the (first) sum of the ai‘s is less than 100 implies that the (second) sum of the iai‘s is less than 1000, hence iai is less than 1000. This reduces the number of possible ten-uplets enough to allow for an enumeration,  hence the following R code:

bounds=c(100,trunc(log(1000)/log(2:10)))

for (i2 in 0:bounds[2])
for (i3 in 0:bounds[3])
for (i4 in 0:bounds[4])
for (i5 in 0:bounds[5])
for (i6 in 0:bounds[6])
for (i7 in 0:bounds[7])
for (i8 in 0:bounds[8])
for (i9 in 0:bounds[9])
for (i10 in 0:bounds[10]){

  A=c(i2,i3,i4,i5,i6,i7,i8,i9,i10)
  if (sum(A)<101){

   A=c(100-sum(A),A)
   if (sum((1:10)*A)==prod((1:10)^A))
     print(A)
  }}

that produces two answers

 [1] 97  0  0  2  0  0  1  0  0  0
 [1] 95  2  3  0  0  0  0  0  0  0

i.e. either 97 1’s, 2 4’s and 1 7, or 95 1’s, 2 2’s and 3 3’s. I would actually love to see a coding solution that does not involve this pedestrian pile of “for”. And a mathematical solution based on Diophantine equations. Rather than the equally pedestrian solution given by Le Monde this weekend.