# Sum of Square Roots Problem

Consider these two lists

A = {1,25,31,84,87,134,158,182,198}
B = {2,18,42,66,113,116,169,175,199}

Now for both lists, add 1,000,000 to each of the numbers then take the sum of their square roots. For example, list A gives us

$\sqrt{1000001}+\sqrt{1000025}+...\sqrt{1000198} = 9000.44998...$

Now what is interesting to note here is that the number obtained from list A and the number obtained from list B differ first in the 37th decimal place. A gives us the digit 2 and B gives us 5. Any explanation as to how/why does this happen? Or rather how were these numbers chosen? Is there some theory behind this, an algorithm perhaps to compile such lists or is it just some random number theory abomination?

-

A quick check shows that $$\sum_{a \in A} a^k = \sum_{b \in B} b^k$$ for $k \in \{1,2,\ldots,8\}$. So you can approximate it using binomial theorem $$\sqrt{a+x} = \sqrt{a} \sqrt{1+\dfrac{x}a} = \sqrt{a} \times \left(1 + \dfrac12 \dfrac{x}a - \dfrac12 \times \dfrac12 \left(\dfrac{x}{a} \right)^2 + \dfrac12 \times \dfrac12 \times \dfrac32 \left(\dfrac{x}{a} \right)^3 \mp \cdots \right)$$ to see that the difference between the two is of the order of $$1000 \times \dfrac12 \times \dfrac12 \times \dfrac32 \times \dfrac52 \times \dfrac72 \times \dfrac92 \times \dfrac{11}2 \times \dfrac{13}2 \times \dfrac{15}2 \times \left(\dfrac{\sum_{a \in A} a^9 - \sum_{b \in B} b^9}{1000000^9} \right) \approx 10^{-37}$$ (since the first nine terms in both the expansions are the same).
Let's take a simpler set: $A=\{1,6,8\}, B=\{2,4,9\}$. We can see that $1+6+8=15=2+4+9, 1^2+6^2+8^2=101=2^2+4^4+9^2$. Then if we form $\sqrt{1000001}+\sqrt{1000006}+\sqrt{1000008}-\sqrt{1000002}-\sqrt{1000004}-\sqrt{1000009}$ we get about $4.5 \cdot 10^{-15}$. The point is that we have canceled out the leading terms in the Taylor series. As Marvis says, $$\sqrt {1000006}= 1000\sqrt{1+\frac 6{1000000}}\approx 1000\left(1+\frac 12\frac 6{1000000}-\frac 12 \cdot \frac 12 \left(\frac 6{1000000}\right)^2+\frac 12 \cdot \frac 12 \cdot \frac 32 \left(\frac 6{1000000}\right)^3\right)$$ where we have kept the first four terms. Because the sum of each set and the sum of squares of each set are the same, the terms linear and quadratic in $\frac 1{1000000}$ will cancel and we will be left with the term in $1000\left(\frac 1{1000000}\right)^3$, which is $10^{-15}$