Archive for Le Monde

Le Monde puzzle [#899]

Posted in Books, Kids, Statistics, University life with tags , , , , , on February 8, 2015 by xi'an

An arithmetics Le Monde mathematical puzzle:

For which n’s are the averages of the first n squared integers integers? Among those, which ones are perfect squares?

An easy R code, for instance

n=10^3
car=as.integer(as.integer(1:n)^2)
sumcar=as.integer((cumsum(car)%/%as.integer(1:n)))
diff=as.integer(as.integer(cumsum(car))-as.integer(1:n)*sumcar)
print((1:n)[diff==00])

which produces 333 values

  [1]   1   5   7  11  13  17  19  23  25  29  31  35  37  41  43  47  49  53
 [19]  55  59  61  65  67  71  73  77  79  83  85  89  91  95  97 101 103 107
 [37] 109 113 115 119 121 125 127 131 133 137 139 143 145 149 151 155 157 161
 [55] 163 167 169 173 175 179 181 185 187 191 193 197 199 203 205 209 211 215
 [73] 217 221 223 227 229 233 235 239 241 245 247 251 253 257 259 263 265 269
 [91] 271 275 277 281 283 287 289 293 295 299 301 305 307 311 313 317 319 323
[109] 325 329 331 335 337 341 343 347 349 353 355 359 361 365 367 371 373 377
[127] 379 383 385 389 391 395 397 401 403 407 409 413 415 419 421 425 427 431
[145] 433 437 439 443 445 449 451 455 457 461 463 467 469 473 475 479 481 485
[163] 487 491 493 497 499 503 505 509 511 515 517 521 523 527 529 533 535 539
[181] 541 545 547 551 553 557 559 563 565 569 571 575 577 581 583 587 589 593
[199] 595 599 601 605 607 611 613 617 619 623 625 629 631 635 637 641 643 647
[217] 649 653 655 659 661 665 667 671 673 677 679 683 685 689 691 695 697 701
[235] 703 707 709 713 715 719 721 725 727 731 733 737 739 743 745 749 751 755
[253] 757 761 763 767 769 773 775 779 781 785 787 791 793 797 799 803 805 809
[271] 811 815 817 821 823 827 829 833 835 839 841 845 847 851 853 857 859 863
[289] 865 869 871 875 877 881 883 887 889 893 895 899 901 905 907 911 913 917
[307] 919 923 925 929 931 935 937 941 943 947 949 953 955 959 961 965 967 971
[325] 973 977 979 983 985 989 991 995 997

which are made of all odd integers that are not multiple of 3. (I could have guessed the exclusion of even numbers since the numerator is always odd. Why are the triplets excluded, now?! Jean-Louis Fouley gave me the answer: the sum of squares is such that

\frac{1+2^2+\cdots+m^2}{m}=\frac{m(m+1)(2m+1)}{6m}=\frac{(m+1)(2m+1)}{6}

and hence m must be odd and 2m+1 a multiple of 3, which excludes multiples of 3.)

The second part is as simple:

sole=sumcar[(1:n)[diff==0]]
scar=as.integer(as.integer(sqrt(sole))^2)-sole
sum(scar==0)

with the final result

> sum(scar==0)
[1] 2
> ((1:n)[diff==0])[scar==0]
[1] 1 337

since  38025=195² is a perfect square. (I wonder if there is a plain explanation for that result!)

the ultimate argument

Posted in Statistics with tags , , , on February 6, 2015 by xi'an

In a tribune published on February 4 in Le Monde [under the vote-fishing argument that the National Front is not a threat for democracy], the former minister [and convicted member of fascist groups in the 1960’s] Gérard Longuet wrote this unforgettable sentence about the former and current heads of the National Front:

“Sa fille, elle, a compris, et d’ailleurs pourquoi serait-elle son père, alors que deux ou trois générations les séparent.”

[Translation:  His daughter has for her part well understood and in any case why should she be her father when there are two or three generations between them.]

another terrible graph

Posted in Books, pictures, Statistics with tags , , , on January 18, 2015 by xi'an

Le Monde illustrated an article about discriminations against women with this graph which gives the number of men for 100 women per continent. This is a fairly poor graph, fit for one of Tufte’s counterexamples, as the bars are truncated at 85, make little sense as they do not convey the time dimension, are dwarfed by the legend on the left that is not of the same colors, and also miss the population dimension, which makes the title inappropriate since the graph does not show why there are more men than women on the planet, even if the large percentage of the population of Asia in the World’s population hints at the result.

foie gras fois trois

Posted in Statistics, Wines with tags , , , , , , on December 31, 2014 by xi'an

As New Year’s Eve celebrations are getting quite near, newspapers once again focus on related issues, from the shortage of truffles, to the size of champagne bubbles, to the prohibition of foie gras. Today, I noticed an headline in Le Monde about a “huge increase in French people against force-fed geese and ducks: 3% more than last year are opposed to this practice”. Now, looking at the figures, it is based on a survey of 1,032 adults, out of which 47% were against. From a purely statistical perspective, this is not highly significant since

\dfrac{\hat{p}_1-\hat{p_2}}{\sqrt{2\hat{p}(1-\hat{p})/1032}}=1.36

is compatible with the null hypothesis N(0,1) distribution.

top posts for 2014

Posted in Books, R, Statistics, University life with tags , , , on December 30, 2014 by xi'an

Here are the most popular entries for 2014:

17 equations that changed the World (#2) 995
Le Monde puzzle [website] 992
“simply start over and build something better” 991
accelerating MCMC via parallel predictive prefetching 990
Bayesian p-values 960
posterior predictive p-values 849
Bayesian Data Analysis [BDA3] 846
Bayesian programming [book review] 834
Feller’s shoes and Rasmus’ socks [well, Karl’s actually…] 804
the cartoon introduction to statistics 803
Asymptotically Exact, Embarrassingly Parallel MCMC 730
Foundations of Statistical Algorithms [book review] 707
a brief on naked statistics 704
In{s}a(ne)!! 682
the demise of the Bayes factor 660
Statistical modeling and computation [book review] 591
bridging the gap between machine learning and statistics 587
new laptop with ubuntu 14.04 574
Bayesian Data Analysis [BDA3 – part #2] 570
MCMC on zero measure sets 570
Solution manual to Bayesian Core on-line 567
Nonlinear Time Series just appeared 555
Sudoku via simulated annealing 538
Solution manual for Introducing Monte Carlo Methods with R 535
future of computational statistics 531

What I appreciate from that list is that (a) book reviews [of stats books] get a large chunk (50%!) of the attention and (b) my favourite topics of Bayesian testing, parallel MCMC and MCMC on zero measure sets made it to the top list. Even the demise of the Bayes factor that was only posted two weeks ago!

Le Monde puzzle [#887quater]

Posted in Books, Kids, R, Statistics, University life with tags , , on November 28, 2014 by xi'an

And yet another resolution of this combinatorics Le Monde mathematical puzzle: that puzzle puzzled many more people than usual! This solution is by Marco F, using a travelling salesman representation and existing TSP software.

N is a golden number if the sequence {1,2,…,N} can be reordered so that the sum of any consecutive pair is a perfect square. What are the golden numbers between 1 and 25?

For instance, take n=199, you should first calculate the “friends”. Save them on a symmetric square matrix:

m1 <- matrix(Inf, nrow=199, ncol=199)
diag(m1) <- 0
for (i in 1:199) m1[i,friends[i]] <- 1

Export the distance matrix to a file (in TSPlib format):

library(TSP)
tsp <- TSP(m1)
tsp
image(tsp)
write_TSPLIB(tsp, "f199.TSPLIB")

And use a solver to obtain the results. The best solver for TSP is Concorde. There are online versions where you can submit jobs:

0 2 1000000
2 96 1000000
96 191 1000000
191 168 1000000
  ...

The numbers of the solution are in the second column (2, 96, 191, 168…). And they are 0-indexed, so you have to add 1 to them:

3  97 192 169 155 101 188 136 120  49 176 148 108 181 143 113 112  84  37  63 18  31  33  88168 193  96 160 129 127 162 199  90  79 177 147  78  22 122 167 194 130  39 157  99 190 13491 198  58  23  41 128 196  60  21 100 189 172 152 73 183 106  38 131 125 164 197  59 110 146178 111 145  80  20  61 135 121  75  6  94 195166 123 133 156  69  52 144  81  40   9  72 184  12  24  57  87  82 62  19  45  76 180 109 116 173 151  74  26  95 161 163 126  43 153 17154  27 117 139  30  70  11  89 107 118 138 186103  66 159 165 124 132  93  28   8  17  32  45  44  77 179 182 142  83  86  14  50 175 114 55 141 115  29  92 104 185  71  10  15  34   27  42 154 170 191  98 158  67 102 187 137 119 25  56 65  35  46 150 174  51  13  68  53  47 149 140  85  36  64 105  16  48

Le Monde puzzle [#887ter]

Posted in Books, Kids, Statistics, University life with tags , , , , on November 27, 2014 by xi'an

Here is a graph solution to the recent combinatorics Le Monde mathematical puzzle, proposed by John Shonder:

N is a golden number if the sequence {1,2,…,N} can be reordered so that the sum of any consecutive pair is a perfect square. What are the golden numbers between 1 and 25?

Consider an undirected graph GN with N vertices labelled 1 through N. Draw an edge between vertices i and j if and only if i + j is a perfect square. Then N is golden if GN contains a Hamiltonian path — that is, if there is a connected path that visits all of the vertices exactly once.g25I wrote a program (using Mathematica, though I’m sure there must be an R library with similar functionality) that builds up G sequentially and checks at each step whether the graph contains a Hamiltonian path. The program starts with G1 — a single vertex and no edges. Then it adds vertex 2. G2 has no edges, so 2 isn’t golden.

Adding vertex 3, there is an edge between 1 and 3. But vertex 2 is unconnected, so we’re still not golden.

The results are identical to yours, but I imagine my program runs a bit faster. Mathematica contains a built-in function to test for the existence of a Hamiltonian path.

g36Some of the graphs are interesting. I include representations of G25 and G36. Note that G36 contains a Hamiltonian cycle, so you could arrange the integers 1 … 36 on a roulette wheel such that each consecutive pair adds to a perfect square.

A somewhat similar problem:

Call N a “leaden” number if the sequence {1,2, …, N} can be reordered so that the sum of any consecutive pair is a prime number. What are the leaden numbers between 1 and 100? What about an arrangement such that the absolute value of the difference between any two consecutive numbers is prime?

[The determination of the leaden numbers was discussed in a previous Le Monde puzzle post.]

Follow

Get every new post delivered to your Inbox.

Join 773 other followers