13

For integers $m$ and $n$, $1<m\le n$ , we need to find the best $m$ so that $S=\sqrt{1}+\sqrt{2}+\sqrt{3}+\sqrt{4}+\dots+\sqrt{m}$ is the closest to an integer.

  • Example: when $n=40$, then the best value of $m$ is $38$, where $S$ is $159.046\dots$

  • Example: when $n=2024$, we have $m=761$ because $S=14008.99997\dots$

I used Microsoft Excel and observes the sums, term-by-term, of the series, which is not a sufficient way for large values of $n$.

Using mathematical equations and formulae, not programs like Excel,

How to find the best value of $m$ if we are given larger values of $n$?

Hussain-Alqatari
  • 5,738
  • 3
  • 16
  • 44

1 Answers1

18

Let $$ F(m) \equiv \left| \sum_{n=1}^{m}\sqrt{n} - \left[ \sum_{n=1}^{m}\sqrt{n} \right] \right| $$ where $[x]$ denotes the nearest integer to $x$. A small value of $F(m)$ tells you that the sum of the first $m$ square roots is near to an integer.

What you are really looking for is the sequence of $m_i$ where $m_i$ is monotonic increasing with $i$ and for each $m_i$ $$ k < m_i \Longrightarrow F(k) > F(m_i) $$ That is, the sequence of "closest to an integer yet" values of $m$.

The easy way to see the start of this sequence is to note that the asymptotic form of $\sum_1^m\sqrt{n}$ is $$ \sum_1^m\sqrt{n}\approx \frac1{\sqrt{n}}\left(\frac{2n^2}{3}+\frac{n}2 +\zeta(-\frac12) \sqrt{n}+\frac1{24}-\frac1{1920 n^2}+ \frac1{9216 n^4}-\frac{11}{163840 n^6}+\frac{65}{786432 n^8}\right) $$ Then in Mathematica you gan define $F[m]$ as that expression, $G[m]$ as Abs$[F[m]-$Round$[F[m]]$ and do a series of DiscretePlot of $G[m]$ to see where you get new minima.

When you do this for up to $m=10^6$ you find the sequence for $m_i$ is $$ \{ 3, 13, 22, 33, 38, 41, 54, 156, 761, 10869, 41085, 142625, 224015, 898612\ldots\} $$ So for example, when $n=500$ the best value of $m$ will be $156$, at which point $$ \sum_1^{156}\sqrt{n}\approx 1305.0000314264 $$ The sequence $m_i$ given above is not in OEIS.


The next number in the sequence is $2750788$ and $$ \sum_1^{2750788}\sqrt{n}\approx 3041547064.000000030776 $$ That nearness ($3\cdot 10^{-8}$) is a significant improvement over its predecessor, which is off by a bit more than one part in a million.

Mark Fischler
  • 42,297
  • 5
    I thought that this problem was beyond the reach of mortals. – Ataulfo Jul 09 '19 at 20:43
  • Can we use $(m+a)^{1/2} = m^{1/2}+ \frac{a}2 m^{-1/2}+O(a^2 m^{-3/2})$ to find the $m$ without computing the function ? – reuns Jul 09 '19 at 22:47
  • 9
    You really should submit this to OEIS. – Deepak Jul 09 '19 at 23:01
  • How do you determine a suitable order to use of the asymptotic expansion? Since we're looking for absolutely nearness (as opposed to relative), I'm guessing the approximation has to be pretty precise to give accurate results – Milten May 13 '24 at 13:32
  • Since you provided this answer, I am trying to know how one can come up with this asymptotic form. Interestingly, it has $\zeta(-\frac{1}{2})$ in it. Yet, from that asymptotic form, how to solve for $m$?. Also, the sequence you provided ${3, 13, 22, 33, 38, \dots }$ is correct except it should starts with $2$ before $3$. – Hussain-Alqatari May 14 '24 at 04:38
  • @Hussain-Alqatari It seems to be from the Euler-Maclaurin formula; see e.g. https://en.wikipedia.org/wiki/Euler%E2%80%93Maclaurin_formula#Asymptotic_expansion_of_sums, https://math.stackexchange.com/a/1241976/620957 – Milten May 14 '24 at 08:56