Skip to main content
Replaced double-backslash-brace pair with single-backslash-brace pair, to fix rendering.
Source Link

This follows by elementary computation: we have \begin{align*} \sum_{r=1}^n\frac{n\bmod r}r&=\sum_{r\le n}\frac nr-\sum_{r\le n}\left\lfloor\frac nr\right\rfloor\\\\ &=nH_n-|\\{(r,s)\in\mathbb N^2:1\le rs\le n\\}|\\\\ &=nH_n-2\sum_{r\le\sqrt n}\left\lfloor\frac nr\right\rfloor+\lfloor\sqrt n\rfloor^2\\\\ &=nH_n-2nH_{\lfloor\sqrt n\rfloor}+n+O(\sqrt n), \end{align*}\begin{align} \sum_{r=1}^n\frac{n\bmod r}r&=\sum_{r\le n}\frac nr-\sum_{r\le n}\left\lfloor\frac nr\right\rfloor\\\\ &=nH_n-|\{(r,s)\in\mathbb N^2:1\le rs\le n\}|\\\\ &=nH_n-2\sum_{r\le\sqrt n}\left\lfloor\frac nr\right\rfloor+\lfloor\sqrt n\rfloor^2\\\\ &=nH_n-2nH_{\lfloor\sqrt n\rfloor}+n+O(\sqrt n), \end{align} hence \begin{align*} \frac1n\sum_{r=1}^n\frac{n\bmod r}r&=H_n-2H_{\lfloor\sqrt n\rfloor}+1+O(n^{-1/2})\\\\ &=\log n+\gamma-2\log\lfloor\sqrt n\rfloor-2\gamma+1+O(n^{-1/2})\\\\ &=1-\gamma+O(n^{-1/2}). \end{align*}\begin{align} \frac1n\sum_{r=1}^n\frac{n\bmod r}r&=H_n-2H_{\lfloor\sqrt n\rfloor}+1+O(n^{-1/2})\\ &=\log n+\gamma-2\log\lfloor\sqrt n\rfloor-2\gamma+1+O(n^{-1/2})\\\\ &=1-\gamma+O(n^{-1/2}). \end{align}

This follows by elementary computation: we have \begin{align*} \sum_{r=1}^n\frac{n\bmod r}r&=\sum_{r\le n}\frac nr-\sum_{r\le n}\left\lfloor\frac nr\right\rfloor\\\\ &=nH_n-|\\{(r,s)\in\mathbb N^2:1\le rs\le n\\}|\\\\ &=nH_n-2\sum_{r\le\sqrt n}\left\lfloor\frac nr\right\rfloor+\lfloor\sqrt n\rfloor^2\\\\ &=nH_n-2nH_{\lfloor\sqrt n\rfloor}+n+O(\sqrt n), \end{align*} hence \begin{align*} \frac1n\sum_{r=1}^n\frac{n\bmod r}r&=H_n-2H_{\lfloor\sqrt n\rfloor}+1+O(n^{-1/2})\\\\ &=\log n+\gamma-2\log\lfloor\sqrt n\rfloor-2\gamma+1+O(n^{-1/2})\\\\ &=1-\gamma+O(n^{-1/2}). \end{align*}

This follows by elementary computation: we have \begin{align} \sum_{r=1}^n\frac{n\bmod r}r&=\sum_{r\le n}\frac nr-\sum_{r\le n}\left\lfloor\frac nr\right\rfloor\\\\ &=nH_n-|\{(r,s)\in\mathbb N^2:1\le rs\le n\}|\\\\ &=nH_n-2\sum_{r\le\sqrt n}\left\lfloor\frac nr\right\rfloor+\lfloor\sqrt n\rfloor^2\\\\ &=nH_n-2nH_{\lfloor\sqrt n\rfloor}+n+O(\sqrt n), \end{align} hence \begin{align} \frac1n\sum_{r=1}^n\frac{n\bmod r}r&=H_n-2H_{\lfloor\sqrt n\rfloor}+1+O(n^{-1/2})\\ &=\log n+\gamma-2\log\lfloor\sqrt n\rfloor-2\gamma+1+O(n^{-1/2})\\\\ &=1-\gamma+O(n^{-1/2}). \end{align}

improve formatting
Source Link
Emil Jeřábek
  • 47.5k
  • 4
  • 150
  • 209

This follows by elementary computation: we have \begin{multline*} \sum_{r=1}^n\frac{n\bmod r}r=n\sum_{r\le n}\frac1r-\sum_{r\le n}\left\lfloor\frac nr\right\rfloor=nH_n-\sum_{rs\le n}1\\\\ =nH_n-2\sum_{r\le\sqrt n}\left\lfloor\frac nr\right\rfloor+\lfloor\sqrt n\rfloor^2=nH_n-2nH_{\lfloor\sqrt n\rfloor}+n+O(\sqrt n), \end{multline*}\begin{align*} \sum_{r=1}^n\frac{n\bmod r}r&=\sum_{r\le n}\frac nr-\sum_{r\le n}\left\lfloor\frac nr\right\rfloor\\\\ &=nH_n-|\\{(r,s)\in\mathbb N^2:1\le rs\le n\\}|\\\\ &=nH_n-2\sum_{r\le\sqrt n}\left\lfloor\frac nr\right\rfloor+\lfloor\sqrt n\rfloor^2\\\\ &=nH_n-2nH_{\lfloor\sqrt n\rfloor}+n+O(\sqrt n), \end{align*} hence $$\frac1n\sum_{r=1}^n\frac{n\bmod r}r=H_n-2H_{\lfloor\sqrt n\rfloor}+1+O(n^{-1/2})=1-\gamma+O(n^{-1/2}).$$\begin{align*} \frac1n\sum_{r=1}^n\frac{n\bmod r}r&=H_n-2H_{\lfloor\sqrt n\rfloor}+1+O(n^{-1/2})\\\\ &=\log n+\gamma-2\log\lfloor\sqrt n\rfloor-2\gamma+1+O(n^{-1/2})\\\\ &=1-\gamma+O(n^{-1/2}). \end{align*}

This follows by elementary computation: we have \begin{multline*} \sum_{r=1}^n\frac{n\bmod r}r=n\sum_{r\le n}\frac1r-\sum_{r\le n}\left\lfloor\frac nr\right\rfloor=nH_n-\sum_{rs\le n}1\\\\ =nH_n-2\sum_{r\le\sqrt n}\left\lfloor\frac nr\right\rfloor+\lfloor\sqrt n\rfloor^2=nH_n-2nH_{\lfloor\sqrt n\rfloor}+n+O(\sqrt n), \end{multline*} hence $$\frac1n\sum_{r=1}^n\frac{n\bmod r}r=H_n-2H_{\lfloor\sqrt n\rfloor}+1+O(n^{-1/2})=1-\gamma+O(n^{-1/2}).$$

This follows by elementary computation: we have \begin{align*} \sum_{r=1}^n\frac{n\bmod r}r&=\sum_{r\le n}\frac nr-\sum_{r\le n}\left\lfloor\frac nr\right\rfloor\\\\ &=nH_n-|\\{(r,s)\in\mathbb N^2:1\le rs\le n\\}|\\\\ &=nH_n-2\sum_{r\le\sqrt n}\left\lfloor\frac nr\right\rfloor+\lfloor\sqrt n\rfloor^2\\\\ &=nH_n-2nH_{\lfloor\sqrt n\rfloor}+n+O(\sqrt n), \end{align*} hence \begin{align*} \frac1n\sum_{r=1}^n\frac{n\bmod r}r&=H_n-2H_{\lfloor\sqrt n\rfloor}+1+O(n^{-1/2})\\\\ &=\log n+\gamma-2\log\lfloor\sqrt n\rfloor-2\gamma+1+O(n^{-1/2})\\\\ &=1-\gamma+O(n^{-1/2}). \end{align*}

Source Link
Emil Jeřábek
  • 47.5k
  • 4
  • 150
  • 209

This follows by elementary computation: we have \begin{multline*} \sum_{r=1}^n\frac{n\bmod r}r=n\sum_{r\le n}\frac1r-\sum_{r\le n}\left\lfloor\frac nr\right\rfloor=nH_n-\sum_{rs\le n}1\\\\ =nH_n-2\sum_{r\le\sqrt n}\left\lfloor\frac nr\right\rfloor+\lfloor\sqrt n\rfloor^2=nH_n-2nH_{\lfloor\sqrt n\rfloor}+n+O(\sqrt n), \end{multline*} hence $$\frac1n\sum_{r=1}^n\frac{n\bmod r}r=H_n-2H_{\lfloor\sqrt n\rfloor}+1+O(n^{-1/2})=1-\gamma+O(n^{-1/2}).$$