0

When I was playing maths in python, I found some specific equation. The main idea was to sum up all decimals of values from between a specific range. The range is from $a^2$ to $(a+1)^2$. It's because for this borderline values the $\sqrt{x}$ is a integer and for all other values it will be some floating point value. My question was into what value the sum will drop to?

The equation: $$ \lim_{a \to \infty} \Bigg[ \sum_{x = a^2}^{(a+1)^2} \bigg( \sqrt(x) - a \bigg) - 1 - a \Bigg] \approx \frac{1}{6} $$

I tried to evaluate this in wolfram, but it don't say anything about this equation.


Why I think that this equation is correct? Here is the code for it, just play with $a$ value, the bigger it will be then the value comes closer to $\frac{1}{6}$:

from decimal import Decimal, getcontext

prec = 25 getcontext().prec = prec + 2

a = 100

s = Decimal(0) for x in range(a ** 2, (a + 1) ** 2 + 1): num = Decimal(x) sqr = num.sqrt() - a s += sqr print(f'>> {x} - {sqr}')

s -= Decimal(1 + a) res = format(s, f".{prec}f")

print() print(f'S: {res}')

and here's also a photo of different values of $a$: enter image description here


Is there any way to calculate the equation and show that it is certainly $\frac{1}{6}$?

Michal
  • 149
  • 8

1 Answers1

2

The Euler–Maclaurin summation formula can show (see this answer to another question) that $$ \sum_{n=1}^p \sqrt n = \frac{2 p^{3/2}}{3}+\frac{\sqrt{p}}{2}+\zeta \biggl(-\frac{1}{2}\biggr)+O\biggl( \frac1{\sqrt p} \biggr). $$ Setting $p=(a+1)^2$ and $p=a^2$ and subtracting yields \begin{align*} \sum_{n=a^2+1}^{(a+1)^2} \sqrt n &= \biggl( \frac{2(a+1)^3}{3}+\frac{a+1}{2} \biggr) - \biggl( \frac{2 a^3}{3} + \frac{a}{2} \biggr)+O\biggl( \frac1a \biggr) \\ &= 2a^2+2a+\frac76+O\biggl( \frac1a \biggr). \end{align*} Therefore \begin{align*} \sum_{n=a^2}^{(a+1)^2} \bigl( \sqrt n - a \bigr) - 1-a &= \sum_{n=a^2+1}^{(a+1)^2} \bigl( \sqrt n - a \bigr) - 1-a \\ &= \sum_{n=a^2+1}^{(a+1)^2} \bigl( \sqrt n \bigr) -(2a+1)a- 1-a = \frac16+O\biggl( \frac1a \biggr). \end{align*} (In fact using one extra term of Euler Maclaurin would show that the error is actually $O(\frac1{a^4})$.) Therefore $$ \lim_{a\to\infty} \sum_{n=a^2}^{(a+1)^2} \bigl( \sqrt n - a \bigr) - 1-a = \frac16 $$ as conjectured.

Greg Martin
  • 78,820