42

All numbers $1$ to $155$ are written on a blackboard, one time each. We randomly choose two numbers and delete them, by replacing one of them with their product plus their sum. We repeat the process until there is only one number left. What is the average value of this number?

I don't know how to approach it: For two numbers, $1$ and $2$, the only number is $1\cdot 2+1+2=5$ For three numbers, $1, 2$ and $3$, we can opt to replace $1$ and $2$ with $5$ and then $3$ and $5$ with $23$, or $1$ and $3$ with $7$ and then $2$, $7$ with $23$ or $2$, $3$ with $11$ and $1$, $11$ with $23$ so we see that no matter which two numbers we choose, the average number remains the same. Does this lead us anywhere?

Key Flex
  • 9,475
  • 7
  • 17
  • 34
  • 8
    You have started the problem the right way, by looking at small similar questions. Perhaps if you work out the next case, keeping track of the way you got to each number (so write the $5$ as $1\times 2 + 1 + 2$) , a pattern and a reason will emerge. – Ethan Bolker Dec 27 '18 at 16:14
  • 3
    Note that the resulting number has 636 digits, so it's not easy to compute even if you understand the trick and can do it 'quickly' (unless you use a computer). – Mees de Vries Dec 27 '18 at 16:18
  • 20
    Denote the process of replacing two numbers $a,b$ by another one by $ab \equiv ab+a+b$. Show that $(ab)c = a(bc)$ and $ab = ba$ (i.e. the binary operation $$ is both associative and commutative). This would prove that order is not important. – Winther Dec 27 '18 at 16:22
  • 2
    The same question has previously been asked on the Puzzling StackExchange: Ten numbers on a blackboard. – theosza Dec 28 '18 at 07:53
  • @MeesdeVries with a computer: 747106292628289444708380937293831544659502112248691679154935029028947927533099589206864815366798234329153235562080607562019236871366935959116501738803666174537810867225241796085310597754619259343815926673638047312709851500780194770609766399999999999999999999999999999999999999 – Henry Dec 29 '18 at 01:25
  • 1
    The question is phrased rather oddly. It seems that the number is fixed; so how can it have an average value? – TonyK Dec 29 '18 at 01:41
  • 1
    @TonyK: A priori, one might imagine that the end result would depend on the sequence of random choices of which numbers to operate on when. The average is with respect to those random choices. – hmakholm left over Monica Dec 29 '18 at 06:32

2 Answers2

51

Claim: if $a_1,...,a_n$ are the $n$ numbers on the board then after n steps we shall be left with $(1+a_1)...(1+a_n)-1$.

Proof: induct on $n$. Case $n=1$ is true, so assume the proposition holds for a fixed $n$ and any $a_1$,...$a_n$. Consider now $n+1$ numbers $a_1$,...,$a_{n+1}$. Suppose that at the first step we choose $a_1$ and $a_2$. We will be left with $ n$ numbers $b_1=a_1+a_2+a_1a_2$, $b_2=a_3$,...,$b_n=a_{n+1}$, so by the induction hypothesis at the end we will be left with $(b_1+1)...(b_n+1)-1=(a_1+1)...(a_{n+1}+1)-1$ as needed, because $b_1+1=a_1+a_2+a_1a_2+1=(a_1+1)(a_2+1)$

Where did I get the idea of the proof from? I guess from the n=2 case: for $a_1,a_2$ you are left with $a_1+a_2+a_1a_2=(1+a_1)(1+a_2)-1$ and I also noted this formula generalises for $n=3$

So in your case we will be left with $156!-1=1\times 2\times...\times 156 -1$

Sorin Tirc
  • 2,087
46

Another way to think of Sorin's observation, without appealing to induction explicitly:

Suppose your original numbers (both the original 155 numbers and later results) are written in white chalk. Now above each white number write that number plus one, in red chalk. Write new red companions to each new white number, and erase the red numbers when their white partners go away.

When we erase $x$ and $y$ and write $x+y+xy$, the new red number is $x+y+xy+1=(x+1)(y+1)$, exactly the product of the two red companions we're erasing.

So we can reformulate the entire game as:

Write in red the numbers from $2$ to $156$. Keep erasing two numbers and writing their product instead. At the end when you have one red number left, subtract one and write the result in white.

Since the order of factors is immaterial, the result must be $2\cdot 3\cdots 156-1$.

  • 2
    Great point! I guess this proof belongs to one of those cases in which induction hides a little how obvious the result is. – Sorin Tirc Dec 27 '18 at 16:53
  • Nice. I hate it when I know something but can't put it into words. – Steven Alexis Gregory Dec 28 '18 at 02:17
  • @SorinTirc: Or, you can think of such proofs as falling into the category of induction proofs that use a loop invariant. Naturally, the loop invariant has one less quantifier than the property under induction, so it feels and looks cleaner. =) – user21820 Dec 28 '18 at 03:35
  • 4
    It’s maybe worth also noting that Henning Makholm’s proof is setting up an isomorphism between ($\mathbb{R},•$) and ($\mathbb{R}, $) where $ab=a+b+ab$ and the isomorphism is given by $f(x)=x-1$ – Sorin Tirc Dec 28 '18 at 10:37