Pringles ran a Super Bowl advert. In case you’re looking for ways to give Pringles more money, apparently you can buy several tubes of Pringles and mix the flavours. (Pringles are a type of food. Super Bowl is a kind of sport. None of that matters, what matters is…) The advert shows a man stacking three Pringles together and claims there are 318,000 possibilities.

Lucy (@honeypisquared) alerted me to this claim and some tweets by @bobloch trying to calculate the number. Bob noticed that the Pringles website has an interactive function to pointlessly simulate the stacking. This insists on precisely three Pringles being stacked together and allows a choice of 18 flavours (on a computer) or 17 flavours (mobile version, as far as I can tell). The website allows repetition (you can choose the same flavour multiple times). If there are 17 options per slot and three slots to fill, this means there are \( 17^3 = 4913 \) possibilities. If there are 18 flavours, this increases to \( 18^3 = 5832 \). Neither are anywhere near big enough.

So where does 318,000 come from? @jjc578 asked Pringles directly. Here’s their response.

So this says there are 25 flavours (weirdly, given how many the website shows) and we are allowed 2, 3 or 4 in a stack (weirdly, given the website insists on 3 only). The comments about not counting different orderings of the same Pringles suggests we are after combinations. Then the number of ways of choosing 2, 3 or 4 from 25 is:

\[ \binom{25}{2}+\binom{25}{3}+\binom{25}{4}=15250 \text{.} \]

Still not big enough.

Then @DavidKButlerUoA worked it out. If we are arranging 2, 3 or 4 Pringles in a stack, chosen without repetition from 25 where order *does* matter, then we use permutations rather than combinations and get this calculation:

\[ \frac{25!}{(25-2)!}+\frac{25!}{(25-3)!}+\frac{25!}{(25-4)!}=318000 \text{.} \]

That’s our magic number! It doesn’t match the Pringles advert, website or Twitter reply, but it’s nice that it does align to some piece of correct maths!

I made this. Here’s how…

Rob Eastaway tweeted a little curiosity he had been given by Tim Rowett – an equation that works as an equation when rotated 180°.

To make this isn’t completely trivial. It seems clear that $x$, $1$ and $8$ have rotational symmetry, such that they work either way up (you may have to draw an unusually symmetric $8$). The same is true of $+$, $-$, implicit multiplication and the horizontal line in a fraction. It is also clear that some numbers have no rotational symmetry and so cannot be used. A $2$, $3$, $4$ or $7$, no matter how you draw it, won’t look like anything useful when rotated. If you draw them right, a $6$ and a $9$ can be rotations of each other. This leaves $5$. As far as I am concerned, if you draw it in a certain way it is recognisable when rotated (as in the tweet at the top of this post).

You also have to consider the order of operations and ensure this makes sense both ways up. For example, you can’t start one side of the equation like $-1+\ldots$, because when rotated this would look like the nonsensical $\ldots+1-$. By careful use of symbols, you can make equations that are valid and soluble when rotated.

So far, so curious. But Rob posed an interesting question: does a similar equation exist that has the *same* solution both ways?

I realised that the arrangement of fractions in the equation Tim gave Rob were leading to one solution one way up and two solutions the other way up, meaning there was no possibility of a complete match. So I wondered if it might be possible to find a set of four constants with appropriate values for which one solution matched.

That is, we want equations of the form

\[ \frac{x}{a}=b-\frac{c-x}{d}\text{.} \]

with $a,b,c,d \in \{1,5,6,8,9\}$, for which one solution of the rotated equation matches the solution of the non-rotated equation.

Say the rotated form is

\[ \frac{e}{x-f}-g=\frac{h}{x}\text{.} \]

Such that $d$ rotates to give $e$ using the following mapping:

\[\begin{align*} 1 &\to 1;\\ 5 &\to 5;\\ 6 &\to 9;\\ 8 &\to 8;\\ 9 &\to 9. \end{align*} \]

And $c$, $b$ and $a$ map to $f$, $g$ and $h$, respectively, using the same mapping.

First, we solve the non-rotated version of the equation in general form:

\[ \begin{align*} \frac{x}{a} &= b-\frac{c-x}{d}\\ \frac{x}{a} – \frac{x}{d} &= b-\frac{c}{d}\\ x \frac{d-a}{da} &= \frac{bd-c}{d}\\ x &= \frac{abd-ac}{d-a}\text{.} \end{align*} \]

Then we solve the rotated version:

\[ \begin{align*} \frac{e}{x-f}-g&=\frac{h}{x}\\ ex – gx(x-f) &= h(x-f)\\ 0 &= gx^2 + (h-e-fg)x – hf \end{align*} \]

So, applying the quadratic formula,

\[ x = \frac{(fg+e-h) \pm \sqrt{(h-e-fg)^2 + 4fgh}}{2g}\text{.} \]

I wrote a little Python 3 program to exhaustively search, testing each of the possible values of $a$, $b$, $c$ and $d$ to see if we had a match.

Here is my `rotate(n)`

function, which take a number `n`

and returns its rotated version.

def rotate(n): if n==1 or n==5 or n==8: return n elif n==6: return 9 elif n==9: return 6 else: raise ValueError("Input should be 1, 5, 6, 8 or 9")

And here is the code for running the search. It uses SciPy for the square root to deal with any potential complex numbers.

import scipy as sp candidatevalues = (1,5,6,8,9) for a in candidatevalues: for b in candidatevalues: for c in candidatevalues: for d in candidatevalues: if d!=a and a!=1 and d!=1: # mustn't divide by zero! Also a and d !=1 so not trivially reducible e = rotate(d) f = rotate(c) g = rotate(b) h = rotate(a) x1 = (a*b*d - a*c) / (d-a) # solution a,b,c,d x2 = ( (f*g+e-h) + sp.sqrt( (h-e-f*g)**2 + 4*f*g*h ) )/(2*g) # +ve solution e,f,g,h x3 = ( (f*g+e-h) - sp.sqrt( (h-e-f*g)**2 + 4*f*g*h ) )/(2*g) # -ve solution e,f,g,h if x1==x2 or x1==x3: print(a,b,c,d," / ",e,f,g,h," / ",x1,x2,x3)

This method found three solutions.

I figure you could set up a neat trick where you say “solve this equation” (the $a$, $b$, $c$, $d$ version), “then rotate the equation 180° and input your value for $x$”. Because the solution to the non-rotated equation is one of the solutions to the rotated one, the player would find their answer works both ways up. Astonishment, fame and riches naturally follow!

But it isn’t completely satisfying, is it?

Playing around on paper, I came up with an equation format that would yield two solutions in either case and ran a similar piece of code. This found eight non-trivial equations that had the same pair of solutions either way. Really, this is four pairs of equations, where each pair are a trivial rearrangement of the each other.

Non-rotated | Rotated | Solutions |
---|---|---|

$\frac{x-1}{6}=\frac{9}{5-x}$ | $\frac{x-5}{6}=\frac{9}{1-x}$ | $x=3 \pm 5\mathrm{i}\sqrt{2}$ |

$\frac{x-1}{9}=\frac{6}{5-x}$ | $\frac{x-5}{9}=\frac{6}{1-x}$ | $x = 3 \pm 5\mathrm{i}\sqrt{2}$ |

$\frac{x-1}{6}=\frac{9}{8-x}$ | $\frac{x-8}{6}=\frac{9}{1-x}$ | $x = \frac{9\pm\mathrm{i}\sqrt{167}}{2}$ |

$\frac{x-1}{9}=\frac{6}{8-x}$ | $\frac{x-8}{9}=\frac{6}{1-x}$ | $x = \frac{9\pm\mathrm{i}\sqrt{167}}{2}$ |

$\frac{x-5}{6}=\frac{9}{8-x}$ | $\frac{x-8}{6}=\frac{9}{5-x}$ | $x = \frac{13 \pm 3\mathrm{i}\sqrt{23}}{2}$ |

$\frac{x-5}{9}=\frac{6}{8-x}$ | $\frac{x-8}{9}=\frac{6}{5-x}$ | $x = \frac{13 \pm 3\mathrm{i}\sqrt{23}}{2}$ |

$\frac{x-6}{5}=\frac{8}{9-x}$ | $\frac{x-6}{8}=\frac{5}{9-x}$ | $x = \frac{15 \pm \mathrm{i}\sqrt{151}}{2}$ |

$\frac{x-9}{5}=\frac{8}{6-x}$ | $\frac{x-9}{8}=\frac{5}{6-x}$ | $x = \frac{15 \pm \mathrm{i}\sqrt{151}}{2}$ |

So far, so good, but the solutions were all complex. In some ways, complex number solutions are fine. But, really, it’d be nicer and more accessible as a trick to have real solutions.

Finally, I did a bit of tweaking to try to increase the chances the discriminant was positive, essentially by changing the minuses to pluses, and found some with real solutions.

Non-rotated | Rotated | Solutions (2 d.p.) |
---|---|---|

$\frac{x+1}{6}=\frac{9}{5+x}$ | $\frac{x+5}{6}=\frac{9}{1+x}$ | $4.62,-10.62$ |

$\frac{x+1}{9}=\frac{6}{5+x}$ | $\frac{x+5}{9}=\frac{6}{1+x}$ | $4.62,-10.62$ |

$\frac{x+1}{6}=\frac{9}{8+x}$ | $\frac{x+8}{6}=\frac{9}{1+x}$ | $3.64,-12.64$ |

$\frac{x+1}{9}=\frac{6}{8+x}$ | $\frac{x+8}{9}=\frac{6}{1+x}$ | $3.64,-12.64$ |

$\frac{x+5}{6}=\frac{9}{8+x}$ | $\frac{x+8}{6}=\frac{9}{5+x}$ | $1,-14$ |

$\frac{x+5}{9}=\frac{6}{8+x}$ | $\frac{x+8}{9}=\frac{6}{5+x}$ | $1,-14$ |

$\frac{x+6}{5}=\frac{8}{9+x}$ | $\frac{x+6}{8}=\frac{5}{9+x}$ | $-1,-14$ |

$\frac{x+9}{5}=\frac{8}{6+x}$ | $\frac{x+9}{8}=\frac{5}{6+x}$ | $-1,-14$ |

From these, I picked one with integer solutions which I found fairly pleasing symmetrically, and tweeted it.

I’m sure there will be other equation formats out there that yield solutions with this property, but that’ll do for me. Here’s the full code that found the eight real solutions.

# non-rotated: (x+a)/b = c/(d+x) # rotated: (x+e)/f = g/(h+x) import scipy as sp def rotate(n): if n==1 or n==5 or n==8: return n elif n==6: return 9 elif n==9: return 6 else: raise ValueError("Number should be 1, 5, 6, 8 or 9") candidatevalues = (1,5,6,8,9) for a in candidatevalues: for b in candidatevalues: for c in candidatevalues: for d in candidatevalues: e = rotate(d) f = rotate(c) g = rotate(b) h = rotate(a) if (not (a==h and b==g and c==f and d==e)) and (not (a==e and b==f and c==g and d==h)) and b!=1 and c!=1: # only test cases that aren't boring and b and c !=1 so not reducible x1 = (-(d+a) + sp.sqrt((d+a)**2 - 4*(a*d-b*c)))/2 # a,b,c,d +ve x2 = (-(d+a) - sp.sqrt((d+a)**2 - 4*(a*d-b*c)))/2 # a,b,c,d -ve x3 = (-(h+e) + sp.sqrt((h+e)**2 - 4*(e*h-f*g)))/2 # e,f,g,h +ve x4 = (-(h+e) - sp.sqrt((h+e)**2 - 4*(e*h-g*f)))/2 # e,f,g,h -ve if (x1==x3 and x2==x4) or (x1==x4 and x2==x3): print(a,b,c,d," / ",e,f,g,h,"/",x1,x2)

This is not unrelated to what I submitted as my entry to The Big Internet Math-Off last summer. I have been revisiting this idea ready for a class next week in my second year programming module.

I have this idea that I am trying to teach my students to program, rather than to write code in a particular language, so I am bullish about throwing them into a different syntax and allowing them to flex their programming muscles. With this in mind, I intend to spend a brief period drawing graphics using TikZ.

My eye was drawn to this picture from the Aperiodvent day 7 entry (which is from this 2015 post by Vicky Neale on Alex Bellos’ Guardian Blog):

I decided to try to recreate these images using TikZ. First, the images. I’m sure the colours could be made prettier, but here is what I got. Click to enlarge.

And now the code. I’m sure it, too, could be made prettier, but it works.

\documentclass[oneside]{article} \usepackage[a4paper,margin=10mm]{geometry} \usepackage{tikz} \begin{document} \pagestyle{empty} ~\vspace{25mm} \begin{center} \begin{tikzpicture} \draw [green, ultra thick] (0,0)--(0,-2); \foreach \i in {0,...,9} { \draw [green, ultra thick] (9-\i,0) -- (0,\i) -- (\i-9,0); } \foreach \i in {0,...,7} { \draw [green, ultra thick] (7-\i,7) -- (0,\i+7) -- (\i-7,7); } \foreach \i in {0,...,5} { \draw [green, ultra thick] (5-\i,12) -- (0,\i+12) -- (\i-5,12); } \draw [red,fill=red] (2,13) circle [radius=0.3]; \draw [yellow,fill=yellow] (-1,13.5) circle [radius=0.3]; \draw [red,fill=red] (-1,9.5) circle [radius=0.3]; \draw [yellow,fill=yellow] (1,9) circle [radius=0.3]; \draw [green,fill=green] (1,8) circle [radius=0.3]; \draw [red,fill=red] (0.8,7) circle [radius=0.3]; \draw [lightgray,fill=lightgray] (-3,7.5) circle [radius=0.3]; \draw [lightgray,fill=lightgray] (1.7,2.7) circle [radius=0.3]; \draw [red,fill=red] (1.2,1.2) circle [radius=0.3]; \draw [yellow,fill=yellow] (-2,1) circle [radius=0.3]; \draw [yellow,fill=yellow] (-2.5,1.5) circle [radius=0.3]; \draw [green,fill=green] (-5,0) circle [radius=0.3]; \end{tikzpicture} \end{center} \newpage ~\vspace{10mm} \begin{center} \begin{tikzpicture}[xscale=0.8,yscale=1.2] \draw [blue,fill=blue] (-11,-10) rectangle (11,10); \foreach \i in {0,...,9} { \draw [yellow, ultra thick] (9-\i,0) -- (0,\i) -- (\i-9,0); \draw [yellow, ultra thick] (9-\i,0) -- (0,-\i) -- (\i-9,0); } \foreach \i in {0,0.2,...,1} { \draw [yellow] (1-\i+9,4) -- (9,\i+4) -- (\i-1+9,4); \draw [yellow] (1-\i+9,4) -- (9,-\i+4) -- (\i-1+9,4); } \foreach \i in {0,0.2,...,1} { \draw [yellow] (1-\i-7,7) -- (-7,\i+7) -- (\i-1-7,7); \draw [yellow] (1-\i-7,7) -- (-7,-\i+7) -- (\i-1-7,7); } \foreach \i in {0,0.2,...,1} { \draw [yellow] (1-\i-8.5,-3) -- (-8.5,\i-3) -- (\i-1-8.5,-3); \draw [yellow] (1-\i-8.5,-3) -- (-8.5,-\i-3) -- (\i-1-8.5,-3); } \foreach \i in {0,0.2,...,1} { \draw [yellow] (1-\i-3,-8) -- (-3,\i-8) -- (\i-1-3,-8); \draw [yellow] (1-\i-3,-8) -- (-3,-\i-8) -- (\i-1-3,-8); } \foreach \i in {0,0.2,...,1} { \draw [yellow] (1-\i+5,-5) -- (+5,\i-5) -- (\i-1+5,-5); \draw [yellow] (1-\i+5,-5) -- (+5,-\i-5) -- (\i-1+5,-5); } \end{tikzpicture} \end{center} \newpage ~\vspace{10mm} \begin{center} \begin{tikzpicture}[scale=1.5] \foreach \i in {0,...,35} { \pgfmathparse{(mod(\i+7,36))*10} \node at (\pgfmathresult:5) (A\i) {}; \pgfmathparse{\i*10} \node at (\pgfmathresult:5) (B\i) {}; \draw [red, ultra thick] (A\i.center)--(B\i.center); } \draw [teal, line width=12] (-1,3) .. controls (1,8) .. (0.3,8.5); \draw [teal, line width=12] (1,3) .. controls (-1,8) .. (0.3,8.5); \draw [teal, fill=teal] (0.3,8.5) circle [radius=0.3]; \end{tikzpicture} \end{center} \end{document}]]>

The result is a command `\stargraph`

, which takes two parameters, the number of radial nodes and the radius in cm of the graph. Here is the definition of `\stargraph`

and its use in a document.

\documentclass{article} \usepackage{tikz} \newcommand{\stargraph}[2]{\begin{tikzpicture} \node[circle,fill=black] at (360:0mm) (center) {}; \foreach \n in {1,...,#1}{ \node[circle,fill=black] at ({\n*360/#1}:#2cm) (n\n) {}; \draw (center)--(n\n); \node at (0,-#2*1.5) {$K_{1,#1}$}; % delete line to remove label } \end{tikzpicture}} \begin{document} \begin{center} \stargraph{7}{2} % usage: \stargraph{number of radial nodes>0}{radius in cm} \end{center} \end{document}

Here is the result of making this document:

]]>So it was that I realised I could enter some Babylonian-style tablets made from gingerbread.

I made a gingerbread reconstruction of a particular tablet, YBC 7289, which Bill Casselman calls “one of the very oldest mathematical diagrams extant“. Bill writes about the notation on the tablet and explains how it shows an approximation for the square root of two. I’m sure I didn’t copy the notation well, because I am just copying marks rather than understanding what I’m writing. I also tried to copy the lines and damage to the tablet. Anyway, here is my effort:

In addition, I used the rest of the dough to make some cuneiform biscuits. I tried to copy characters from Plimpton 322, a Babylonian tablet thought to contain a list of Pythagorean triples. Again, Bill Casselman has some interesting information on Plimpton 322.

Below, I try to give a description of my method.

I tried the recipe given but I don’t know if I mistranslated the American cups measurements, but it came out too dry, so I adjusted the ingredients and tried again before making it the third time for real. Below is a description of what I did.

The idea here is to make a gingerbread that tastes good but crucially has the stiffness to take the cuneiform writing and that doesn’t rise much so the writing stays in place while it cooks. There’s a lot of chilling to harden the dough. I should mention that you make the dough one day and cook it the next.

Ingredients:

- 500g plain white flour;
- 110g soft brown sugar;
- 160g butter;
- 145g treacle;
- 1 medium egg;
- 1 teaspoon bicarbonate of soda;
- 2 teaspoons ground ginger powder;
- half teaspoon cinnamon;
- half teaspoon nutmeg;
- half teaspoon salt.

Method:

Day one, mix the dough.

- Weigh the butter and cut up into lumps, leave on a plate to warm up for at least 20 minutes.
- Mix the dry ingredients in a bowl.
- Add the butter and mix up.
- Add the treacle and egg and mix well. I used a food processor. It made a stiff dough.
- Compress into a bowl, cover with cling film and put in the fridge overnight.

Day two, make the gingerbread.

- Roll out the dough. I made a big tablet and a set of little biscuits. I put a tea towel on the side with greaseproof paper on top, and rolled on this using a rolling pin and some flour. The dough is quite happy to be pushed around and cut up.
- Put the rolled out dough on greaseproof paper on baking sheets and put it in the fridge for half an hour to re-stiffen.
- Cuneiform writing using a square handle of a chopstick. The linked blog post has a lot on this, including a nice video demonstration of the technique. I bought some cheap chopsticks online, and while the handles were square, they were a bit too rounded. This meant the impressions made in the gingerbread were not very clear, especially after baking. My parents had a sharper-handled chopstick and I was able to use this for the real thing. So it is important to get the right tool. I also used a blunt knife for making lines and a teaspoon for scraping out sections of the tablet I was copying that were broken.

- After scribing, refrigerate again while heating up the oven.

- I cooked mine at gas mark 4 for 10 minutes (biscuits) or 12 minutes (large tablet). Our oven is a bit quirky, though, so you might want to experiment. The first go I over-cooked them a little.

Probably by now you are firmly of the view that I am not a recipe writer! There is a lot more detail in the original blog post and I recommend reading this and watching the short video before starting.

I am grateful to Farrell Monaco for sharing her cuneiform gingerbread recipe, and to Bill Casselman for his pages on Babylonian mathematics tablets.

]]>Bernard Bolzano (1781 – 1848) worked to "free calculus from the concept of the infinitesimal" and was born on 5 Oct http://bit.ly/9TV331

— Maths History (@mathshistory) October 5, 2010

That autumn, I looked into the Twitter API and wrote myself a program that would run every day and tweet these little titbits. I loaded some messages into a database and scheduled a daily tweet at 10:23am starting from 16th December 2010.

Johann Radon (1887-1956) worked on the calculus of variations, differential geometry & measure theory & was born 16 Dec http://bit.ly/eAQlSK

— Maths History (@mathshistory) December 16, 2010

Over the months that followed, I slowly built up a database of daily tweets, sometimes managing to get a few weeks ahead of the present, and sometimes missing days and filling them in the following year. Sometime in 2011 or 2012, I had a full year’s tweets in the database. Since then, I have been tweaking. Sometimes someone sends in an error and I make a correction. I’ve also swapped all the URLs from bit.ly (necessary in 2010 to fit the message in a tweet) to the full address. But, generally speaking, the script has pushed a daily mathematician onto the feed every day since then without interference.

Generally speaking, this has had some success. The account currently has about 65k followers. Twitter’s statistics system regularly records 10,000 ‘impressions’ per tweet (which Twitter defines as “Times a user is served a Tweet in timeline or search results”), several times that for a big name. (Though I tried to set up the database to promote less-well-known names and areas, of course the big names cause most interest.)

There is more to history than marking dates and reading biographies, but as an exercise in raising some awareness of history of mathematics, I think it is going pretty well.

And today I sent my last @mathshistory daily mathematician tweet.

Michael Mästlin (1550-1631) Kepler's teacher, publicised the Copernican system, born 30 Sep https://t.co/DVTY0o9Oev

— Maths History (@mathshistory) September 30, 2018

Since BSHM got themselves a web server a little while ago, we have been chatting about moving the daily tweets over to it. I remain a member of BSHM, but I finished my term on Council in 2013. I think it does the Society a lot of good to have full control over its Twitter account and not be relying on me and my server. Over the summer we duplicated the database and code, and over the last few days we’ve been testing it. Now it’s ready to go.

So ends my eight-year run tweeting daily mathematicians from @mathshistory. Tomorrow’s tweet will be served from BSHM. Basically, followers should notice no difference, but for me it will be very strange – the first ever @mathshistory daily mathematician tweet not sent by me.

]]>Nim objects could be anything, of course, but conventionally sticks or stones are used. There are various types of dot in LaTeX that might look like stones, but somehow a line of dots didn’t seem satisfactory. There are various ways to draw a line (not least simply typing ‘|’), including some tally markers (e.g. in hhcount). My problem with these (call me picky) is that they are all identical lines, and a ‘heap’ of them just looks very organised. Really, I want a set of lines that looks like someone just threw them into heaps (though probably without crossings for the avoidance of ambiguity). So I wrote my own.

I used PGF/TikZ. My basic strategy was to draw a thick vertical line in TikZ with a little wobble added so each one doesn’t look extremely well-lined-up with its neighbour, achieved by adding or subtracting a small random number in PGF. This is a command `\drawnimstick`

. On top of this, I made a command `\nimgame{}`

which takes a comma-separated list of numbers and makes a row of Nim heaps with those numbers of sticks. For example, `\nimgame{5,2,3}`

makes a 3-pile Nim game with five sticks in the first pile, two in the second and three in the third. There is no limit to the number of piles or the number in a pile, but this code doesn’t do anything to cope when line breaks start happening because I only anticipate using small numbers of small piles myself.

Here are the definitions of the commands `\drawnimstick`

and `\nimgame{}`

.

% load packages and seed random number \usepackage{pgf,tikz} \pgfmathsetseed{\number\pdfrandomseed} % command \drawnimstick draws a single Nim stick with a little random wobble. \newcommand{\drawnimstick}{% \pgfmathsetmacro{\topx}{(random(0,20)-10)/100}% top of the line: 0 +/- random \pgfmathsetmacro{\botx}{(random(0,20)-10)/100}% bottom of the line: 0 +/- random \begin{tikzpicture}% \draw[very thick] (\topx,0) -- (\botx,0.5);% draws line \end{tikzpicture}% } % command \nimgame takes a comma-separated list of numbers and makes Nim heaps holding those number of sticks \newcommand{\nimgame}[1]{% \begin{center}% \def\listofgames{#1}% \foreach \heap in \listofgames {% picks the numbers from the list \foreach \index in {1, ..., \heap} {% loops for this heap \drawnimstick\hspace{0.5mm}% draws a stick + 0.5mm space }% \hspace{10mm}% 10mm horizontal space between heaps }% \end{center}% }

And here are some examples of it in action:

\documentclass{article} ...(the above definitions here)... \begin{document} % examples Here is a multi-pile Nim game: \nimgame{1,3,2} Here is another multi-pile Nim game: \nimgame{10,20} Here is another multi-pile Nim game: \nimgame{2,3,4,7,6,5} \end{document}

Here is the output of the code above (of course, if you run it again, all the lines shift because the random parameters vary on run time):

]]>I made a silly joke, and it made me think.

You may be aware that our own Christian Lawson-Perfect is running the Big Internet Math-Off here at the Aperiodical, a single-elimination tournament with sixteen competitors. I was knocked out in round one by the brilliant Alison Kiddle. I joked that if Alison went on to win, then I’d be joint second.

Much as I like and respect @ch_nira, I’ll be rooting for @ajk_44. If she goes on to win the #BigMathOff final and is crowned The World’s Most Interesting Mathematician, then I’m joint-second, right? https://t.co/8Jt37gHFif

— Peter Rowlett (@peterrowlett) July 10, 2018

I’ve been mulling this over and I felt there was something there in thinking about the placement of the non-winners in such a tournament, so I had a play.

I started by doing the only sensible thing: I used an online random name generator to generate sixteen names and arranged them into eight first-round matches. Lacking an actual competition and with the Big Internet Math-Off in recent memory, I decided each match by generating a random number $0$-$100$ for one opponent and taking $100$ minus this for the other. Think of it, if you like, as percentage of a public vote. Thankfully, there were no draws, so I didn’t have to invent a tiebreaker rule.

Here’s the outcome, written up using this lovely LaTeX tournament code example.

Clearly, Michal wins, by winning the final. But who came second? Norah lost the final, so clearly has a claim to being second. She won one fewer match than did the winner.

But what about Betsy? Michal beat Betsy, so if we choose to believe the fiction of the tournament, Betsy is worse (at being assigned a random number $>50$) than Michal. But is she better or worse that Norah? Think about it. I’d say we don’t know, because this hasn’t been tested. We know Michal is better than Betsy, and Michal is better than Norah, but whether Betsy is better or worse than Norah is untested. All we can do, therefore, is award them joint second place. They both lost one match, to Michal, and they didn’t play each other.

But there are a bunch of other people who also lost only one match to Michal and haven’t played each other. If they hadn’t been knocked out, perhaps they could have gone on to win, or at least prove themselves better than one of our second-place candidates. So perhaps they are all joint second. The people Michal knocked out are: Norah, Betsy, Camilla and Maia.

By the same logic, if you were knocked out by a second-place competitor, you might have a claim to being joint third. As Michal beat Norah and Norah beat Yasmin, there’s a clear ordering here that puts Yasmin third. But Siobhan, who was beaten by joint-second-place Betsy, hasn’t played Yasmin, so I don’t think we can reasonably say Yasmin is better (at being assigned a random number $>50$) than Siobhan. The people beaten by a second-place competitor are: Yasmin, Iris and Amirah (knocked out by Norah), Cathy and Hiba (knocked out by Betsy) and Abigail (knocked out by Camilla).

Who was knocked out by a third-place competitor? Lacie and Judy (knocked out by Yasmin), Niamh (knocked out by Iris) and Siobhan (knocked out by Cathy). By the same logic, these are joint fourth place.

There is now only one competitor not placed: Agnes, who was knocked out by Lacie. An argument could be constructed to put her as the only competitor in fifth place.

Here’s a diagram showing the tournament with these placements.

So in the **final**, we have two competitors: one in first place, one in second.

In the **semi-finals**, four: one first, two second and one third. That is, the two from the final are there in their original positions, plus they each knock out one competitor who is, therefore, placed one less than them.

In the **quarter-finals**: one first, three second, three third and one fourth.

In the **first round**: one first, four second, six third, four fourth and one fifth.

Round | 1st | 2nd | 3rd | 4th | 5th |
---|---|---|---|---|---|

Final | 1 | 1 | 0 | 0 | 0 |

Semi | 1 | 2 | 1 | 0 | 0 |

Quarter | 1 | 3 | 3 | 1 | 0 |

1st | 1 | 4 | 6 | 4 | 1 |

Do we recognise these numbers? Labelling from the final backwards, at each stage we keep the competitors from the stage that happens after it in their places and add as many again that they knocked out, each one place below them. So, e.g., the number of second place competitors in the semi-final is the sum of the number of first and second place competitors in the final. In general, the number in column $m$ in row $n$ is made from the number who were in column $m$ in row $n-1$ plus the number in column $m-1$ in row $n-1$. We are making Pascal’s triangle.

I don’t think about single-elimination tournaments very much (I didn’t know the term until very recently), probably because I have little-to-no interest in sport. Is this result obvious to everyone? I appreciate it’s not the most practical way to look at a tournament — I’m not sure that anyone would seriously buy my argument that someone who rocked up in round one and won nothing, but happened to be playing the eventual winner, deserves joint second-place with the person who won three matches to be knocked out in the final. But as a bit of fun with logic, I thought it was quite nice.

Sadly, Alison was knocked out in the second round by Nira Chamberlain, so, depending on Nira’s performance in later rounds, the best I can hope for is joint-third place, and I might yet be fifth.

]]>This claim was famously made by Carl Sagan in the seminal programme Cosmos.

The cosmos is rich beyond measure. The number of stars in the universe is larger than all the grains of sand on all the beaches of the planet Earth.

More or Less come to a fairly standard answer, that Sagan was correct. This sort of problem, which involves approximating unknowable numbers based on a series of estimates, is called a Fermi problem. I’ve written about Fermi problems here before. The More or Less approach to answering this raised a question from a reader of this blog.

But that's less than a factor of 3 difference! For Fermi estimates of numbers of that size, those two answers are essentially the same. It wouldn't take much of an error in either estimate to push sand ahead of stars…

— Paul Taylor (@aPaulTaylor) July 8, 2018

Alright, actually Paul is one of the writers of this blog, rather than a reader. Even so, are his concerns warranted?

The numbers in the More or Less piece are

- for stars: “1 followed by 22 zeros” (approx. 4:18 in the podcast audio), described as 10 sextillion;
- for sand: “3.65 with 21 zeros after it” (approx. 8:30), described as about 4 sextillion.

Fermi estimation involves making order-of-magnitude estimates based on informed guesses about the inputs. (Listen to the More or Less piece if you want to hear this process in action.) Then, given the level of estimation, you aren’t supposed to take too seriously differences within the same order of magnitude – 3 million and 5 million can’t be taken to be seriously different – but if one number comes out at least an order of magnitude bigger than the other, you take this to be your conclusion. In that sense, what More or Less did was correct – 10 sextillion is one order of magnitude bigger than 4 sextillion and so, we conclude, bigger.

There is an uncomfortable feeling which comes from how similar these numbers are, given the amount of guessing involved. Something about comparing so-many sextillions and some-other-number-of sextillions seems like there isn’t that much difference. Actually, the difference between $4 \times 10^{21}$ and $1 \times 10^{22}$ is $6 \times 10^{21}$, so we’d need More or Less to have missed out more than half the sand on Earth in estimating to have come to the wrong conclusion.

There are people who’ll tell you that the only number to pay attention to in a Fermi estimate is the $10^n$ term, because the other is just noise. But this leads to awkwardness. In this case, $4 \times 10^{21}$ is four times bigger than $1 \times 10^{21}$ but only two-and-a-half times smaller than $10^{22}$. Can we really say $1 \times 10^{21}$ and $9 \times 10^{21}$ are effectively the same, while $10 \times 10^{21}$ is significantly bigger?

It’d certainly be a clearer conclusion if the numbers came out several orders of magnitude different, but then obviously very differently-size numbers wouldn’t make for such an interesting piece of rhetoric, would they? The real question you have to ask, then, is whether any doubts you have about the way each number was estimated amounts to a big enough difference in either number.

I guess it is also possible to think about this estimation method too seriously — it’s only really designed to give a rough-and-ready, back-of-the-envelope guesstimate. There’s something about the way the More or Less piece suddenly comes to a conclusion and ends, with a definitive-sounding “Carl Sagan was right” and “he nailed it”. I’d say a few more caveats would have been appropriate. Some discussion of upper and lower bounds, or just an acknowledgement of how much error would cause the conclusion to flip, might have been nice. Paul points out, and I think he’s right, that the fact these numbers are pretty close is remarkable, and perhaps this could have been remarked upon. So, in conclusion, I don’t think the More or Less conclusion is necessarily wrong, but it could have been framed better.

]]>Yesterday morning, my son and I did something similar with our cat, Tabby. This is in response to Matt Parker’s latest initiative, Psychic Pets. Matt is hoping to get thousands of pet owners to make predictions, in order that the odds are good a pet can be found which predicted all prior results for both teams in the final. The good news is it’s fairly straightforward to take part.

Matt’s made a video which explains.

And, for readers who are teachers, there are teaching resources related to the project from Think Maths.

I figure there are teams people Matt reaches are more likely to pick and some that are likely to be less well-picked, and so chose Peru to help Matt get good coverage and because their first match was later the same day. I wrote out sheets with team names and ‘draw’, and offered Tabby the choice of each combination of sheets with a cat biscuit on it. (I’m not completely on top of the details of the World Cup, but the Psychic Pets website has all the info.) Tabby is the sort of cat who will do almost anything for a cat biscuit, even take part in one of Matt’s silly projects. She made her basic three predictions, which I videoed and uploaded to the site.

Made a contribution for @standupmaths’ latest stupid project, @PsychicPets.

You can do it too! https://t.co/yGgW5rI6YB pic.twitter.com/mmHRrmFH9Z— Peter Rowlett (@peterrowlett) June 16, 2018

Well, it didn’t take long to learn that her first prediction, Peru for the win, wasn’t to be. Pat Parslow pointed out on Twitter that this doesn’t prove my cat isn’t psychic — she could be toying with me. But, either way, it doesn’t help advance Matt’s cause.

But, while it’s too late for Tabby, do you have a pet and could get involved? Get started at Psychic-Pets.com.

]]>