# A winning competition

As part of this year’s MathsJam gathering, as for the last few years, we held a competition competition (you may have seen Peter’s recent post about his entry to the same event in 2014). My competition was the winner, and I thought I’d share with you some of the entries, as I very much enjoyed reading them all.

I guess I’m alone in this, since Matt Parker’s ‘guess the mean of the digits in all the entries’ competition received the most entries of any competition meaning he also won a prize.

Bored with ‘guess the mean of all the entries’ style competitions, I decided to come up with something that flips this concept on its head.

My competition was to come up with a function for mapping a set of $N$ integers onto a single value, and whoever’s function takes a pre-determined set of integers I’m thinking of closest to a particular predetermined value I’m thinking of is the winner. I was slightly sloppy in the way I defined the question (I used $N$ to refer to both the set of numbers, and the size of the set) but everyone responded beautifully – with only some people feeling the need to point out my error – in what became a virtual festival of making up your own notation.

I received 32 entries to the competition, not all of which were actually valid entries – several had the bright idea of using ‘the number you’re thinking of’ as a variable in their function, which is 100% cheating. Here are some of my favourites, in increasing order of amazingness, culminating with the winning entry (scroll down to the bottom if you just want to see that).

### But What Were The Numbers? The set of numbers I was thinking of was in fact The Numbers, from the TV series Lost – in which a seemingly random set of integers play a mysterious yet crucial role in the plot. The numbers are 4, 8, 15, 16, 23 and 42. As well as being one character’s winning lottery numbers, and popping up in various other places, for a whole chunk of season 2 the numbers must be typed into a computer every 108 minutes, or else… something bad will happen.

I actually quite enjoyed it but I have notoriously bad taste in TV and films.

If you haven’t seen Lost, and you have a spare 122 hours of your life you’re happy to not get back, go for it.

My set of numbers is therefore as follows: 4, 8, 15, 16, 23 and 42 (in that order). The target number for the function was chosen to be zero, for reasons I can’t explain (mostly panic).

On to the entries!

### Simple but elegant functions

Several examples fell into this category – including:

$f(x_0, x_1, \ldots, x_N) = N$

Simply counting the number of numbers (minus one). While we appreciate your lovely and obfuscating zero-indexing, this gives the answer $5$.

$f(x,y) = x^2 – y$

Since this function is only defined on two inputs, we took the first two, giving $4^2 – 8 = 8$.

$f(x_1, x_2, \ldots, x_N) = x_N^2 – 1$

Taking the last of the numbers and squaring it, then subtracting one. This gives $42^2 – 1 = 1763$.

Various statistical functions, including the square of the mean, the upper quartile, the lower quartile and the ‘anti-mode‘ (the least common value, and if there’s more than one value equally uncommon, the mean of these – since the set is all distinct, this is just the mean LOL!).

These gave the values $240.25, 19.5, 11.5$ and $18$.

The first prime not a factor of any of the numbers”

This is $11$.

Return a random element of the set”

Since the target value isn’t in the set, this won’t work but it’s a nice try!

$f: x_1 \ldots x_N \rightarrow \frac{e^{\min(x_i)} \cdot \pi^{\max(x_i)}}{N}$

Almost like Euler’s identity in how it effortlessly combines mathematical constants, but sadly returns a result in the region of $7 \times 10^{21}$.

### Sums and products of series

Many entries fell into this category:

$f(x_1, x_1, \ldots, x_N) = \frac{\displaystyle\sum_{i=1}^N (-1)^i i x_N}{N}$

If this was meant to be an alternating sum of multiples of successive entries, which is how I initially interpreted it, it also doesn’t sum to zero. And you should be more careful with notation, because this is exactly what was written.

An alternating sum of multiples of the largest entry, which given $i$ runs from $1$ to $6$ means you end up with a total of three times that entry, divided by 6 – giving $x_N/2 = 42/2 = 21$.

$f(n_1, n_1, \ldots, n_N) = \frac{\displaystyle\prod_{i=1}^N n_i}{N}$

The product of all the entries divided by the number of entries, which is $1,236,480$ (very much not zero).

The $\big(\displaystyle\prod_{i=1}^N x_i\big)^{th}$ prime number, modulo $\displaystyle\sum_{i=1}^N x_i$

This one returns 67.

$\frac{1}{M} = \frac{1}{x_1} +\frac{1}{x_2} + \cdots +\frac{1}{x_N}$

For reference, $M$ was the name I gave to my target value, and this was described as the ‘parallel resistance sum’. It works out to give $M = 1.7499207463\ldots$.

$f(x) =\displaystyle\sum_{k=1}^n \sin (kx_k)$

I like it, but it gives $-1.168\ldots$ – close, but no cigar.

### Trivially defined functions

Several entries took a chance on me, and hoped they could guess what number I was thinking of, defining their function as the constant function giving a single value regardless of the inputs. Entries of this form, in increasing order of size, included $\pi, 4, 7, 20$ and $37$, sadly none of which win.

### Stupidly complex to compute functions

Ask a stupid question, and you’ll get the following answers. We tried to calculate some of these in the ten minutes we had to judge the competition, but for some of them we merely established they were definitely not zero and gave up.

$f(x_1, x_2, \ldots, x_N) = x_1 + \frac{1}{x_2+ \frac{1}{\cdots + \frac{1}{x_{N-1} + \frac{1}{x_N}}}}$

A continued fraction. We calculated the answer but all that’s written on here is “4.something”. Not equal to zero.

“Arrange the numbers in order and multiply the difference between them in pairs.”

I enjoy a good bit of tedious busy work, and I got $3724$.

$f(n_1, n_2, \ldots, n_x) = (x+2) \cdot \sqrt{n_1 \cdot n_x \cdot\displaystyle\prod_{\textrm{all } x} n_x}$

Interesting notation switcheroo from what everyone else seems to be using. This was a pain to calculate too and my bit of paper says ‘TOO BIG’.

“The median of all the answers to this competition + 1”

Given that we had 32 different entries, some of which we couldn’t properly calculate, but there was literally no chance the median answer was $-1$, the only thing written on the paper is the word ‘NO’.

“Sum the number of letters of the positive integers, minus the number of letters of the negative integers”

It’s lovely! Our bit of paper says “about 40ish?” but if anyone wants to work it out, go for it.

“For each element of N, go to the Wikipedia page for N(i) and find the N(i)th letter on the page; typecast this letter into I32 and take the sum of these values”

A bit of Googling has allowed me to establish that this is a way of converting letters into numbers, but since I assume none of the standard letters convert to a negative number, this will definitely not equal zero.

$f(x_1, x_2, \ldots, x_N) = e^{e^{\displaystyle\sum_{i=1}^N x_i}}$

We had a go at calculating this in Google Sheets, which was our terrible calculating tool of choice under pressure, and the value was actually too big for it to handle. In some ways, this could be the least correct answer.

### Cheating

Given that I named the number I was thinking of $M$, I received a small selection of entries from people who didn’t want to play like normal people, at least one of which just specified $f(N)=M$ – this is OBVIOUSLY not what you were meant to do. Others tried to define a function in terms of $N$ and $M$, including the following:

$f(x_1, x_2, \ldots, x_N) = \begin{cases} \Bigg(\frac{\displaystyle\sum_{i=1}^N \displaystyle\sum_{j=1}^{x_i} x_i^j}{N!}\Bigg)^{\displaystyle\frac{1}{x_{\max{3,N}}}}&& \textrm{if }N\textrm{ is coprime with }M\\ 6 && \textrm{otherwise} \end{cases}$

For the record, while typing this in LaTeX I’ve hit a record of four consecutive close braces. Sadly $6$, the number of entries in my list, is not coprime with $0$, so this gives the answer $6$ (and is disqualified anyway for using $M$ in the definition).

$f(N,M) = 0. \big(\displaystyle\sum_{i=1}^{N-2} x_i\big) + M$

This was presumably hoping to get as small a number as possible in the first part, then add it to M and hope nobody was closer. Turns out not only is this cheating, it was also not close enough, because we did actually get an exact winner, and it was glorious. See below.

### The Winning Entry

$f(n_1, n_2, n_3, \ldots, n_N) = n_2 + n_3 + \ldots + n_N \mod n_1$

This function takes all but the first number, adds them together and then takes the result modulo the first number, aka remainder on division. In the case of The Numbers, the result is:

$f(4, 8, 15, 16, 23, 42) = (8 + 15 + 16 + 23 + 42) \mod 4 \equiv 0$

Amazingly, through pure chance, the sum of these five numbers (104) is a multiple of 4, and so the answer is zero! We have a winner. Congratulations to the winner, who forgot to write their name on the sheet, but was identified and awarded their prize – a wind-up robot, as per the rules of the Competition Competition, worth strictly less than £1.

• 