I am somewhat a noob, and I don't recall my math preparation from college. I know that the sum $\displaystyle \sum_{n\geq 1}\frac{1}{n}$ is divergent and my question is if the sum$$\sum \limits _{n\geq 1}\frac{2^n\mod n}{n^2}$$converges. I think is not but I do not know how to prove that! Thanks!
-
you can use Mathjax when typing . – Nizar Oct 12 '16 at 09:30
-
Intuitively it diverges, as $2^n\bmod n$ must be $O(n)$, tightly. – Oct 12 '16 at 09:38
-
@YvesDaoust Could you elaborate more on why $2^n\mod n$ is $\mathcal{O}(n)$? – Jacky Chong Oct 12 '16 at 09:40
-
My thoughts exactly I think it is the same thing with sum_{n>=1} \frac{1}{2n} as n/2 is the average of 2^n mod n – Aurelian Florea Oct 12 '16 at 09:43
-
1@JackyChong I expect $2^n\bmod n$ to be uniformly distributed in $[0,n-1]$. (Of course anything $\bmod n$ is $O(n)$, so the point is more about the "expectation" of $2^n\bmod n$). – Oct 12 '16 at 09:44
-
@AurelianFlorea: how do you know that the average is $n/2$ ? – Oct 12 '16 at 10:14
-
I don't If is n/2 then problem solved! – Aurelian Florea Oct 12 '16 at 10:16
3 Answers
In this answer, we prove that
$$ \sum_{n=1}^{\infty} \frac{2^n \text{ mod } n}{n^2} = \infty. \tag{*} $$
Idea. The intuition on $\text{(*)}$ comes from the belief that the sequence $(2^n \text{ mod } n)/n$ is equidistributed on $[0, 1]$, which is quite well supported by numerical computation.
Proving this seems quite daunting, though, so we focus on a particular subsequence which is still good to give a diverging lower bound of $\text{(*)}$. To be precise, we focus on the indices of the form $n = 5p$ for some prime $p$ and prove that the corresponding sum is comparable to the harmonic series for primes $\sum_p \frac{1}{p}$, which also diverges.
Proof. To this end, we consider the sequence $(a_k : k \geq 0)$ in $[0, 1)$ defined by
$$ a_k = \left\{ \frac{2^{5p_k}}{5p_k} \right\},$$
where $\{ x \} = x - \lfloor x \rfloor$ is the fractional part of $x$ and $p_k$ is the $k$-th prime number. Now focusing only on the index $n = 5p_k$ for some $k$, we can bound the sum $\text{(*)}$ below by
$$ \sum_{n=1}^{\infty} \frac{2^n \text{ mod } n}{n^2} = \sum_{n=1}^{\infty} \frac{1}{n}\left\{ \frac{2^n}{n} \right\} \geq \sum_{k=1}^{\infty} \frac{a_k}{5p_k}. $$
So it suffices to prove that this bound diverges. First, for any prime $p$ we have
$$ 2^{5p} \equiv 2^5 \equiv 32 \pmod{p}. $$
This allows us to write $2^{5p} = mp + 32$ for some non-negative $m$. Next, notice that any prime $p$ other than $2$ and $5$ are either of the form $p = 4k+1$ or of the form $p = 4k+3$. Depending on which class $p$ falls in, we find that
$$ 2^{5p} \equiv 2^p \equiv \begin{cases} 2, & \text{if } p =4k+1 \\ 3, & \text{if } p =4k+3 \end{cases} \pmod{5}. $$
What this tells about $m$ is as follows:
$$ m \equiv \begin{cases} 0, & \text{if } p =4k+1 \\ p^{-1}, & \text{if } p =4k+3 \end{cases} \pmod{5}. $$
(Here, $p^{-1}$ is the multiplicative inverse of $p$ modulo $5$.) From this, for $p_k > 32$ we have the following estimate:
$$ a_k \geq \frac{1}{5} \quad \text{if } p_k \equiv 3 \pmod{4}. $$
Consequently, by the PNT for arithmetic progression,
$$ \frac{a_1 + \cdots + a_n}{n} \geq \frac{1}{5} \frac{\pi_{4,3}(p_n) + \mathcal{O}(1)}{\pi(p_n)} \xrightarrow[n\to\infty]{} \frac{1}{10}. $$
(The $\mathcal{O}(1)$-term appears by discarding terms with $p_k \leq 32$.) Finally, let $s_n = a_1 + \cdots + a_n$. Then by summation by parts, as $N \to \infty$ we have
\begin{align*} \sum_{k=1}^{N} \frac{a_k}{5p_k} &= \frac{1}{5} \bigg( \frac{s_N}{p_N} + \sum_{k=1}^{N-1} \left( \frac{1}{p_k} - \frac{1}{p_{k+1}} \right) s_k \bigg) \\ &\geq \frac{1}{5} \sum_{k=1}^{N-1} \left( \frac{1}{p_k} - \frac{1}{p_{k+1}} \right) \frac{k}{11} + \mathcal{O}(1) \\ &\geq \frac{1}{55} \sum_{k=1}^{N} \frac{1}{p_k} + \mathcal{O}(1). \end{align*}
Taking $N \to \infty$, this series diverges by the harmonic series for primes. Therefore the claim $\text{(*)}$ follows. ////
Elaborating this argument, we find that
$$ a_k \equiv \frac{2^{5p_k}}{5p_k} \equiv \tilde{a}_k + \frac{32}{5p_k} \pmod{1} $$
where $\tilde{a}_k$ satisfies
$$ \tilde{a}_k = \begin{cases} 0, & \text{if } p_k \equiv 1, 9, 13, 17 \pmod{20} \\ 1/5, & \text{if } p_k \equiv 11 \pmod{20} \\ 2/5, & \text{if } p_k \equiv 3 \pmod{20} \\ 3/5, & \text{if } p_k \equiv 7 \pmod{20} \\ 4/5, & \text{if } p_k \equiv 19 \pmod{20} \end{cases}. $$
Thus by the PNT for arithmetic progression again, we have the following convergence in distribution:
$$ \frac{1}{n} \sum_{k=1}^{n} \delta_{a_k} \xrightarrow{d} \frac{1}{2}\delta_{0} + \frac{1}{8}\sum_{j=1}^{4} \delta_{j/5} \quad \text{as } n \to \infty$$
The following numerical simulation using first 1,000,000 terms of $(a_k)$ clearly demonstrates this behavior:

- 167,468
-
3Good job! I, too, noticed "horizontal dashed lines" at heights $k/5$, $k=0,1,2,3,4$ when I gave Mathematica the command to
ListPlot
values ofMod[2^n,n]/n
. But I didn't get that those lines come from the case $n=5p$. – Jyrki Lahtonen Oct 14 '16 at 11:41 -
2@JyrkiLahtonen, Thank you! I chose the number $5$ out of no clear reason (except that the proof becomes simpler), but now your graph explains why this choice works. – Sangchul Lee Oct 14 '16 at 11:52
-
@SangchulLee , First thank you for solving the problem. Second could you take a look at this related topic: http://math.stackexchange.com/questions/1965123/sum-of-the-series-sum-n-geq1-fracpn-bmod-qn-n2?noredirect=1#comment4033713_1965123 I'm still not sure I understand your proof so I'll re-read it. I don't think I'll manage to prove the above on my own, but I'll try! – Aurelian Florea Oct 14 '16 at 13:39
-
@SangchulLee, Isn't sum((2^n mod n)/n^2) suppose to equal sum((1/n^2){2^n/n}) rather than sum((1/n){2^n/n}) and then equal to sum(ak/25pk^2) – Aurelian Florea Oct 17 '16 at 09:19
-
@SangchulLee Have you noticed and understood my previous comment? – Aurelian Florea Oct 18 '16 at 09:21
-
@AurelianFlorea, I am not sure what you mean, but recall that $2^n \text{ mod } n$ is the unique number $r \in [0, n)$ such that $2^n = qn + r$ for some integer $q$. Dividing both sides by $n$, you see that $r/n$ is exactly the fractional part of $2^n / n$, which we denote by ${2^n / n}$. So $$ \frac{2^n \text{ mod } n}{n^2} = \frac{1}{n} \cdot \frac{2^n \text{ mod } n}{n} = \frac{1}{n} \bigg{ \frac{2^n}{n} \bigg}. $$ – Sangchul Lee Oct 18 '16 at 09:25
-
Ok, now I understand, I hadn't comprehended that step, thanks! – Aurelian Florea Oct 18 '16 at 09:30
-
-
@SangchulLee It will be so cool if you could approach this related problem link ,too. I'll try to apply your line of reasoning for it, but you could get there first. I have technically accepted an answer, but now I consider it wrong, As soon as I find the correct answer, the wrong answer will go away! – Aurelian Florea Oct 18 '16 at 10:14
-
@SangchulLee I'm sorry to bother you again like that but I need a clarification. Here it is what Wolfram Alpha comes with no on this matter now (that's more than the result on the same inquiry a month ago, or so I guess): https://www.wolframalpha.com/input/?i=series%5B(2%5En+mod+n)%2Fn%5E2%5D – Aurelian Florea Dec 03 '16 at 12:19
-
@SangchulLee Where is that sine function above coming from and why does it seem to me that this is now convergent? I mean there is a sum of sin (bordered) over something that goes to infinity. Thanks ! – Aurelian Florea Dec 03 '16 at 12:23
-
@SangchulLee I managed to understand that is about the Fourier expansion of the series, I'd like to appologize for wasting your time! – Aurelian Florea Dec 04 '16 at 05:48
-
@SangchulLee Sorry for this very late comment, but I just happened to notice that $$0.293181\ln(0.718621n+1)$$ seems to be a very good approximation of the sum. Do you have any ideas how that might corroborate with your answer (or any part of it)? – Soham Saha Feb 16 '24 at 07:27
-
Not an answer, just for insight. Here is a plot of the $1000$ first $\dfrac{2^n\mod n}n$, to substantiate the "uniform distribution" hypothesis.
The second plot is the prefix sum, which is a straight line for a uniform distribution. The average of the values is $0.287$ (not very close to $0.5$).
Unfortunately, this empirical data isn't sufficiently conclusive.
Here are histograms of the fractional part of the $10000$, $100000$ and $1000000$ first values. Beware that the frequency axis is logarithmic. There is a strong bias towards the small values (one third below $0.01$), but this doesn't seem to worsen with $n$.
I conjecture that for any $n$, at least $50\%$ of the values of $\{2^k/k\}$ are above $0.1$.
Very interestingly, the histogram of the values $2^n\bmod n$ themselves shows very strong lines for all powers of $2$.
This leads us to the next histogram, where the moduli that are powers of $2$ have been ignored. There is no more need for a logarithmic scale and the distribution looks pretty flat now.
-
Could you turn this into a histogram plot for the density in [0,1]? – H. H. Rugh Oct 12 '16 at 10:01
-
-
If I understand the cumulative sum correctly, the distribution seems more biased towards 0? (you mean 0.287 and not 2.87 I suppose?) – H. H. Rugh Oct 12 '16 at 10:12
-
-
Yes, but the average seems fairly stable (suggesting strongly the divergence in any case). There are the primes for which you just get 2/n but they are fairly rare (and powers of 2, even more rare). – H. H. Rugh Oct 12 '16 at 10:17
-
-
@Yves Daoust This has hunted me the for the past few days, but I haven't been able to come up with a solution, the only thing I came up with is that for the series to converge we need an integer k to be the finite maximum of 2^n mod n, whichever the n. That doesn't seem likely but how to prove it? – Aurelian Florea Oct 14 '16 at 03:49
-
@H.H.Rugh It seems I can't notify you all in one comment so I made a second one. – Aurelian Florea Oct 14 '16 at 03:50
-
@Jacky Chong It seems I can't notify you all in one comment so I made a third one. – Aurelian Florea Oct 14 '16 at 03:51
-
@AurelianFlorea: you probably mean a minimum value of $k$. For the series to diverge, I guess that you should have $k=\Omega(n)$ often enough. – Oct 14 '16 at 07:17
-
1When you look at a plot of ${2^x/x}$ for real $x$ (fractional part), you get a lattice of quasi-parallel quasi-vertical quasi-line segments, the density of which goes increasing. Maybe one can establish something about the distribution of the intercepts with verticals $x=n$ ? – Oct 14 '16 at 07:23
-
1Note that for every (odd) prime $n$ you have $2^n\equiv 2\bmod n$. That may be what's biasing the data toward the low side. – Gerry Myerson Oct 14 '16 at 08:49
-
@GerryMyerson: this is a part of the explanation. Among the $247782$ remainders below $0.01n$ (for $n\le1000000$), $20$ yield $0$ (they are powers of $2$), $0$ yield $1$ (this has been proven for all $n$ it seems) and $157488$ yield $2$. The frequencies for the other histogram bins are closeto $7000$. – Oct 14 '16 at 09:21
-
Yes, $2^n\not\equiv1\bmod n$ was a Putnam problem in 1972 or so. $2^n\equiv3\bmod n$ has a few known solutions, but the smallest is about half a billion. – Gerry Myerson Oct 14 '16 at 09:38
-
-
1
-
Here is a possible explanation of high frequencies of $2^n$. Let $p, q$ be primes so that $q \equiv p \pmod{p-1}$, For each fixed $p$, PNT tells us that there are roughly $\frac{\pi(n)}{\varphi(p-1)}$ such primes $q$ between $1$ and $n$. Now for such $q$, we have $$ 2^{pq} \equiv 2^p \pmod{q} \quad \text{and} \quad 2^{pq} \equiv 2^q \equiv 2 \equiv 2^p \pmod{p}. $$ Thus by the chinese remainder theorem, $$ 2^{pq}\equiv 2^p \pmod{pq}. $$ For instance, if $p = 3$ then there $\pi(10^6/3) - 1 = 28664$ odd primes with $3q \leq 10^6$ and they contribute to $$2^{3q} \text{ mod } 3q = 2^3. $$ – Sangchul Lee Oct 15 '16 at 04:24
-
@YvesDaoust If you liked this problem maybe you'll enjoy the more general case [here] (http://math.stackexchange.com/questions/1974148/nature-of-the-series-sum-n-geq1-frac-fn-pn-bmod-qn-dn-whe) – Aurelian Florea Oct 18 '16 at 15:34
-
@GerryMyerson If you liked this problem maybe you'll enjoy the more general case http://math.stackexchange.com/questions/1974148/nature-of-the-series-sum-n-geq1-frac-fn-pn-bmod-qn-dn-whe – Aurelian Florea Oct 18 '16 at 15:36
-
@H.H.Rugh If you liked this problem maybe you'll enjoy the more general case http://math.stackexchange.com/questions/1974148/nature-of-the-series-sum-n-geq1-frac-fn-pn-bmod-qn-dn-whe – Aurelian Florea Oct 18 '16 at 15:37
The point of this post is to give some plots that corroborate Sangchul Lee's argument. These were produced by Mathematica
The first plot lists the numbers $(2^n\mod n)/n$ for all multiples of $5$. You see the horizontal lines at multiples of $0.2$. They were already visible in the unrestricted plot, when I didn't restrict $n$ to multiples of five, but here they are easier to spot:
When we only include the values $n=5p$, the picture is even clearer:
Multiples of five are not the only structure in there. Restricting the choice of $n$ to numbers of the form $n=7p$ gives something quite similar.

- 133,153
-
I had just started staring at the former image, when Sangchul Lee posted their solution. Look at that answer for an explanation. – Jyrki Lahtonen Oct 14 '16 at 11:51
-
I hope that it is clear to all why the first image hides the pattern of the last. The first image was just vaguely hinted in the unrestricted plot but the last is already mostly lost in the noise. When you know what to look for, it is a lot easier to see it. – Jyrki Lahtonen Oct 14 '16 at 12:10
-
If you liked this problem please check the more general case here: http://math.stackexchange.com/questions/1974148/nature-of-the-series-sum-n-geq1-frac-fn-pn-bmod-qn-dn-whe – Aurelian Florea Oct 18 '16 at 15:39