1

I learnt that

$$\lim_{n\rightarrow \infty} \frac{1}{n^2}\sum_{k=1}^{n}(n \bmod k)=1-\frac{\pi^2}{12}$$

where $ (n{\bmod {k}})$ is the remainder upon division of $n$ by $k$. However, I am not sure how to arrive at this equation.

I understand that

$$\infty \bmod 1 = 0$$ But I don't see how infinity can mod anything else. For example, $$\infty \bmod 2 = ~?$$ $$\infty \bmod 3 = ~?$$ I am thinking about either converting the limit into an integral, but I haven't figured out how. Any hints on how to evaluate the limit?

I also found a more general form of the limit (not sure if this will help with the original question): For $a>0,~b\geq1$, $$\lim_{n\rightarrow \infty} \frac{1}{n^2}\sum_{k=1}^{an}(an \bmod bk)=a^2\left(1-\frac{\pi^2}{12b}\right)$$

rtybase
  • 16,907
Larry
  • 5,090

1 Answers1

8

Using division with remainder, if $n=q_kk+r_k$ s.t. $0\leq r_k < k$, then $r_k=n \pmod{k}$. Also $q_k=\left \lfloor \frac{n}{k} \right \rfloor$ and $$r_k=n-k\left \lfloor \frac{n}{k} \right \rfloor$$ Then $$\frac{1}{n^2}\sum_{k=1}^{n}(n \bmod k)= \frac{1}{n^2}\sum_{k=1}^{n}r_k= \frac{1}{n^2}\sum_{k=1}^{n}\left(n-k\left \lfloor \frac{n}{k} \right \rfloor\right)=\\ 1-\frac{1}{n}\sum_{k=1}^{n}\frac{k}{n}\left \lfloor \frac{n}{k} \right \rfloor \to \color{red}{1-\int\limits_{0}^{1}x\left \lfloor \frac{1}{x} \right \rfloor dx}, n\to\infty \tag{1}$$

Now $$\int\limits_{0}^{1}x\left \lfloor \frac{1}{x} \right \rfloor dx= \int\limits_{0}^{\frac{1}{2}}x\left \lfloor \frac{1}{x} \right \rfloor dx + \int\limits_{\frac{1}{2}}^{1} xdx= \int\limits_{0}^{\frac{1}{3}}x\left \lfloor \frac{1}{x} \right \rfloor dx + \int\limits_{\frac{1}{3}}^{\frac{1}{2}} 2xdx + \int\limits_{\frac{1}{2}}^{1} xdx=\\ \int\limits_{0}^{\frac{1}{4}}x\left \lfloor \frac{1}{x} \right \rfloor dx + \int\limits_{\frac{1}{4}}^{\frac{1}{3}} 3xdx + \int\limits_{\frac{1}{3}}^{\frac{1}{2}} 2xdx + \int\limits_{\frac{1}{2}}^{1} xdx=\\ \sum_{n=1}n \int\limits_{\frac{1}{n+1}}^{\frac{1}{n}} xdx= \sum_{n=1}\frac{n}{2} \left(\frac{1}{n^2}-\frac{1}{(n+1)^2}\right)= \frac{1}{2}\sum_{n=1}\frac{2n+1}{n(n+1)^2}=\\ \frac{1}{2}\sum_{n=1}\frac{n+n+1}{n(n+1)^2}= \frac{1}{2}\sum_{n=1}\left(\frac{1}{(n+1)^2}+\frac{1}{n(n+1)}\right)=\\ \frac{1}{2}\sum_{n=1}\left(\frac{1}{(n+1)^2}+\frac{1}{n}-\frac{1}{n+1}\right)=\\ \color{red}{\frac{1}{2}\sum_{n=1}\frac{1}{(n+1)^2}}+\color{blue}{\frac{1}{2}\sum_{n=1}\left(\frac{1}{n}-\frac{1}{n+1}\right)}=\\ \color{red}{\frac{1}{2}\sum_{n=1}\frac{1}{n^2}-\frac{1}{2}}+\color{blue}{\frac{1}{2}}=\frac{1}{2} \cdot \frac{\pi^2}{6}$$ which indeed is $\frac{\pi^2}{12}$, because of this.

rtybase
  • 16,907