Skip to content

Instantly share code, notes, and snippets.

@anantham
Created November 18, 2016 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anantham/34fb849af60ff1a01c4978ed1320e060 to your computer and use it in GitHub Desktop.
Save anantham/34fb849af60ff1a01c4978ed1320e060 to your computer and use it in GitHub Desktop.
the origin of the question asked on math.stackexchange

Question 5

There is a set containing $1, 2, \cdots, 199$, we proceed to continuously select (at random) $2$ numbers ($a$ and $b$) then compute the number $c = (a+b+ab)$. We remove both $a$ and $b$ while we add $c$ to this set. Finally what will the final remaining number be?

Solution 5

The question seems to suggest that no matter which two numbers you choose, in every possible ordering, the final answer will be the same number. Lets generalize the question for integers $1, 2, \cdots, n$.

For $n=1$, the answer is $1$. For $n = 2$, the answer is $(1+2+2) = 5$. For $n = 3$, the first iteration yields $(5,3)$, $(11,1)$, or $(2,7)$. Which all lead to $23$.

Initially the sum of the $n$ numbers is $\frac{n(n+1)}{2}$. In each iteration we remove $a$ and $b$, decreasing the sum by $a$ and $b$ while we add $(a+b+ab)$.

So the net change in the sum after each iteration will be $(-a+-b+a+b+ab )= ab$. So $Sum_{new} = Sum_{old} + ab$.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment