Prove that $$\lim\limits_{k\to\infty}\left(\frac1k\sum\limits_{n=1}^k\left\lfloor\frac kn\right\rfloor-\ln k\right)=2\gamma-1$$

I have approximated this limit with python:

import math

len = 10000000000

ans = 0.0
x = 1
while (x<len):
    ans += len/x
    x = x + 1

ans = ans/len - math.log(len)

print ans

# this is the value i got for len = 10 billion:   0.154433

If anyone knows anything about this limit I would be extremely interested to hear about it. I came up with it when thinking about the Euler - Mascheroni Constant which is defined similarly.

The main difference here is the I have in a sense rounded the harmonics down to a values that form discrete intervals of [0,1].

It appears that this limit is one less than twice the Euler - Mascheroni Constant or at least very close according to the program I wrote. If anyone could prove this or suggest any ways I might attempt to do so that would be great.

Stated more clearly where L is the limit and γ is the Euler - Mascheroni Constant:

L = 2γ-1
  • $\begingroup$ I guess there is an error in your python code. $\endgroup$ Commented May 11, 2017 at 5:13
  • $\begingroup$ where is the error? $\endgroup$
    – Mathew
    Commented May 11, 2017 at 5:21
  • $\begingroup$ Coding. Please wait. $\endgroup$ Commented May 11, 2017 at 5:21
  • $\begingroup$ It should run as is. It runs on my mac. I have this version of python: 2.7.10 $\endgroup$
    – Mathew
    Commented May 11, 2017 at 5:24
  • 1
    $\begingroup$ We can write $n^{-1}\sum_{k=1}^n\lfloor n/k\rfloor=H_n-\theta_n$ where $$\theta_n:=\frac1n\sum_{k=1}^n\left\{\frac{n}k\right\}$$ Hence $\theta_n\in (0,1)$ for all $n\in\Bbb N$. Then it seems that $$\lim_{n\to\infty}\frac1n\left(\sum_{k=1}^n\left\lfloor\frac{n}k\right\rfloor\right)-\ln n\in(\gamma-1,\gamma)$$ $\endgroup$
    – Masacroso
    Commented May 11, 2017 at 6:34

2 Answers 2


Note that

$$\tag{1}\frac1k\sum\limits_{n=1}^k\left\lfloor\frac kn\right\rfloor-\ln k = -\frac1k\sum\limits_{n=1}^k\left(\frac{k}{n}-\left\lfloor\frac kn\right\rfloor\right)-\left( \sum_{n=1}^k \frac{1}{n} - \ln k\right).$$

We have

$$\lim_{k \to\infty}\left( \sum_{n=1}^k \frac{1}{n} - \ln k\right) = \gamma,$$

and the first term on the RHS of (1) is a Riemann sum converging to

$$\lim_{k \to\infty}-\frac1k\sum\limits_{n=1}^k\left(\frac{k}{n}-\left\lfloor\frac kn\right\rfloor\right) = - \int_0^1 \left\{\frac{1}{x} \right\}\, dx, $$

where $\{ \cdot \}$ denotes fractional part.

It remains to show that the integral equals $\gamma - 1$.

This follows from

$$\begin{align}\int_0^1 \left\{\frac{1}{x} \right\}\, dx &= \int_1^\infty \frac{\{y\}}{y^2}\, dy \\ &= \sum_{k=1}^\infty \int_k^{k+1} \frac{y-k}{y^2} \, dy \\ &= \sum_{k=1}^\infty \left( \ln \frac{k+1}{k} - \frac{1}{k+1}\right) \\ &= \lim_{n \to \infty} \sum_{k=1}^n \left(\ln \frac{k+1}{k} - \frac{1}{k+1} \right) \\ &= \lim_{n \to \infty} \left(\ln (n+1) - \sum_{k=1}^n \frac{1}{k+1}\right) \\ &= 1 - \gamma \end{align}$$


$$\lim_{k \to \infty} \left(\frac1k\sum\limits_{n=1}^k\left\lfloor\frac kn\right\rfloor-\ln k \right) = \gamma -1 + \gamma = 2 \gamma -1$$

  • $\begingroup$ Really well done, it is clearly explained. :-) $\endgroup$
    – user90369
    Commented May 11, 2017 at 10:07

Well I do not think your Python code has a bug.

To prove it you have to use Dirichlet's asymptotic formula(Theorem 3.3).(You can see Apostol's analytic number theory P$57$).I do not want to tell you how to prove that formula(Because It can be found in the textbook,It is not worth much). I only tell you how to use it(See picture).

$d(n)$ means divisor function, it equals how many divisor $n$ has.

Now evaluate $S_1= \sum\limits_{n \leq k}d(n)$. Is it equal to $S_2=\sum\limits_{n=1}^k\lfloor\frac{k}{n}\rfloor$? If the answer is Yes, we can reduce it to the theorem showed in the picture (Theorem $3.3$). The answer is actually yes. For $n=1$, $k$ positive integers no more than $k$ has divisor $1$, for $n=2$, $\lfloor \frac{k}{2} \rfloor$ integers have divisor $2$. for $n=3,4,...,k$, cases are nearly the same. Hence, $S_1=S_2$, Dirichlet's asymtotic formula comes to use (we can reduce your problem to the theorem 3.3 in the picture).

Well, the answer shows that your problem has a background in number theory.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .