# Do Arithmetic Mean and Geometric Mean of Prime Numbers converge?

I was looking at a list of primes. I noticed that $\frac{AM (p_1, p_2, \ldots, p_n)}{p_n}$ seemed to converge.

This led me to try $\frac{GM (p_1, p_2, \ldots, p_n)}{p_n}$ which also seemed to converge.

I did a quick Excel graph and regression and found the former seemed to converge to $\frac{1}{2}$ and latter to $\frac{1}{e}$. As with anything related to primes, no easy reasoning seemed to point to those results (however, for all natural numbers it was trivial to show that the former asymptotically tended to $\frac{1}{2}$).

Are these observations correct and are there any proofs towards:

$${ \lim_{n\to\infty} \left( \frac{AM (p_1, p_2, \ldots, p_n)}{p_n} \right) = \frac{1}{2} \tag1 }$$

$${ \lim_{n\to\infty} \left( \frac{GM (p_1, p_2, \ldots, p_n)}{p_n} \right) = \frac{1}{e} \tag2 }$$

Also, does the limit $${ \lim_{n\to\infty} \left( \frac{HM (p_1, p_2, \ldots, p_n)}{p_n} \right) \tag3 }$$ exist?

• Can we take $p_n = n\cdot log(n)$ in these limits? (using the prime numbers theorem) Commented Sep 15, 2018 at 14:45
• What are AM, GM & HM? Commented Sep 15, 2018 at 17:11
• @corey979 Arithmetic, geometric, and harmonic means; together, these are known as the Pythagorean means. Commented Sep 15, 2018 at 17:18
• For what it's worth, the answer to the question in the title is "No". Commented Sep 15, 2018 at 17:37

Your conjecture for GM was proved in 2011 in the short paper On a limit involving the product of prime numbers by József Sándor and Antoine Verroken.

Abstract. Let $p_k$ denote the $k$th prime number. The aim of this note is to prove that the limit of the sequence $(p_n / \sqrt[n]{p_1 \cdots p_n})$ is $e$.

The authors obtain the result based on the prime number theorem, i.e., $$p_n \approx n \log n \quad \textrm{as} \ n \to \infty$$ as well as an inequality with Chebyshev's function $$\theta(x) = \sum_{p \le x}\log p$$ where $p$ are primes less than $x$.

• @TheSimpliFire I think we simply can't conclude that the sequence is strictly decreasing based on the first $15$ values. In a paper from 2016 on the same topic, the author points out that the sequence converges slowly. Commented Sep 15, 2018 at 15:01
• @TheSimpliFire Also, going to a third digit clarifies the issue: the $GM/p_n$ for $n=5$ is about $0.428$ and the $GM/p_n$ for $n=6$ is about $0.429$, so even in the beginning the sequence is not strictly decreasing. Commented Sep 15, 2018 at 17:37
• @Soham Good question. For positive $x_i$, we have $\min(x_1,\ldots,x_n) \le HM(x_1,\ldots,x_n) \le n\min(x_1,\ldots,x_n)$. This means that for the first $n$ primes, $$2 \le HM(p_1,\ldots,p_n) \le 4,$$ so the limit of $HM/p_n$ will vanish to $0$. Commented Sep 15, 2018 at 17:43
• @Théophile Do you mean $2 \leq HM(p_1, \ldots, p_m) \leq 2n$? The result still follows, of course, since $\frac{2n}{n\log n} \to 0$. Commented Sep 15, 2018 at 17:56
• @TheSimpliFire : the formula in the cited literature is just your reciprocal. Additionally, if you use $p_{n-1}$ in the denominator of your formula it looks as if this could as well converge to $e$... Commented Sep 15, 2018 at 18:40

We can use the simple version of the prime counting function $$p_n \approx n \log n$$ and plug it into your expressions. For the arithmetic one, this becomes $$\lim_{n \to \infty} \frac {\sum_{i=1}^n p_i}{np_n}=\lim_{n \to \infty} \frac {\sum_{i=1}^n i\log(i)}{np_n}=\lim_{n \to \infty} \frac {\sum_{i=1}^n \log(i^i)}{np_n}\\=\lim_{n \to \infty} \frac {\log\prod_{i=1}^n i^i}{np_n}=\lim_{n \to \infty}\frac {\log(H(n))}{n^2\log(n)}$$ Where $H(n)$ is the hyperfactorial function. We can use the expansion given on the Mathworld page to get $$\log H(n)\approx \log A -\frac {n^2}4+\left(\frac {n(n+1)}2+\frac 1{12}\right)\log (n)$$ and the limit is duly $\frac 12$

I didn't find a nice expression for the product of the primes.

• Thanks. Not as though I understand the proof, though..haha Commented Sep 15, 2018 at 16:39
• So, I just tried the same with HM too..This one I'm not sure, converged or not, to a non-zero number..could well be going to zero..For the first 1 lakh numbers, it dropped down to 0.02 levels..Does this limit exist? Commented Sep 15, 2018 at 16:46
• I added some detail of how I got to $H(n)$. The asymptotic expansion came from the Mathworld page I linked to. Commented Sep 15, 2018 at 22:59
• In which sense are you using the $\approx$ symbol? It's not clear to me that you can simply replace $p_i$ with $i \log i$ in your computations. In general this kind of replacement properties do not hold. Commented Sep 17, 2018 at 11:46
• @FedericoPoloni: It is valid with the standard definition, $p_n \approx n \log(n) \iff p_n = n \log(n) + o(p_n)$. If you plug this exact value into $\frac{\sum p_i}{np_n}$ you get $\frac{\sum i\log(i)}{np_n} + \frac{o(p_n)}{np_n}$. The rightmost part vanishes to $0$ near infinity so everything is fine. Commented Sep 18, 2018 at 13:02

Here is a general answer to this which will solve the case for AM, GM and HM in one shot.

Observe that since $$p_n \sim n\log n$$, as $$n \to \infty$$ the proportion of numbers formed by the sequence of ratios $$\frac{p_1}{p_n},\frac{p_2}{p_n} \ldots, \frac{p_{n-1}}{p_n}$$ which fall inside any sub-interval within $$(0,1)$$ is proportion to the length of that interval i.e. the sequence $$\frac{p_r}{p_n}$$ approaches equidistributed in $$(0,1)$$ [for the proof of equi/uniform distribution, see the comment below by Mariuslp]. Hence, for an equidistributes sequence, we have:

Theorem: Let $$p_k$$ be the $$k$$-th prime and let $$f$$ be a continuous function Riemann integrable in $$(0,1)$$ then,

$$\lim_{n \to \infty}\frac{1}{n}\sum_{r = 1}^{n}f\Big(\frac{p_r}{p_n}\Big) = \int_{0}^{1}f(x)dx.$$

(See the proof in this MO link for a direct proof). Taking $$f(x) = x, \log(x)$$ and $$\frac{1}{x}$$ respectively with some manipulations, we get the required limit for AM, GM and HM as $$\frac{1}{2},\frac{1}{e}$$ and $$0$$ respectively.

Example: Showing the case for GM due to request in the bellow comments. Let $$\lim_{n \to \infty}\frac{(p_1 p_2 \ldots p_n)^{1/n}}{p_n} = \lim_{n \to \infty}\Big(\frac{p_1}{p_n}\Big)^{1/n} \Big(\frac{p_2}{p_n}\Big)^{1/n} \ldots \Big(\frac{p_n}{p_n}\Big)^{1/n} = l$$

Clearly, $$0 < l < 1$$. Taking logarithm on both sides, we have $$\log l = \lim_{n \to \infty} \frac{1}{n} \sum_{r = 1}^{n}\log \Big(\frac{p_r}{p_n}\Big) = \int_{0}^{1} \log x dx = -1.$$

Hence $$l = 1/e$$.

• In which sense are those ratios uniformly distributed? What is the probability space here? And isn't the last of those ratios always 1? Commented Sep 17, 2018 at 6:46
• I don't see how that integral would be 1/e resp. 0 in the last two cases. Commented Sep 17, 2018 at 14:26
• @TorstenSchoeneberg: For the second case, the left hand side is the logarithm of the GM, so the right hand side needs to be $-1$, not $1/e$. Also, in the third case you've got 1/HM on the left. Commented Sep 17, 2018 at 14:46
• This is a great answer.
– user193810
Commented Sep 18, 2018 at 6:28
• @NilotpalKantiSinha: As counterintuitive as it is to me you are right. For those who struggled like me, in $[\alpha, \beta]$ there are $\pi(\beta p_n) - \pi(\alpha p_n) \approx \frac{\beta p_n}{\ln (\beta p_n)} - \frac{\alpha p_n}{\ln (\alpha p_n)}$ primes, on a total of $\pi(p_n) \approx \frac{p_n}{\ln(p_n)}$. Knowing that $\ln(an) \approx \ln(n)$ for any $a>0$, with some manipulations (remember we cannot replace by equivalents in a sum), we do get a $\beta - \alpha$ proportion of primes in the interval. Commented Sep 18, 2018 at 14:24

Not an answer, but an illustration of the type of convergence of (2). I reproduced the formula for the geometrical mean in the version reciprocal to the OP's formula to match the formula of the cited literature. The curve shows the deviation from $e$ and the slowness of convergence.

The red curve is the running mean using 7 data points.

About the harmonic mean: I believe that it exists, but it is zero.

The harmonic mean limit (HML) is $$HML=\lim_{n\rightarrow\infty}\left(\frac{HM(p_1,p_2,\ldots)}{p_n}\right).$$ The harmonic mean itself can be written as $$HM(p_1,p_2,\ldots)=\frac{n}{\sum_{i=1}^{n}\frac{1}{p_i}}.$$ The asymptotic behavior of the sum in the fraction is (see Mathworld): $$\sum_{i=1}^{n}\frac{1}{p_i}=\ln \ln p_n + B_1 + o(1),$$ with $B_1 \approx0.261$ the Mertens constant, so the asymptotic behavior of the harmonic mean is $$HM(p_1,p_2,\ldots)=O\left(\frac{n}{\ln \ln p_n}\right)=o(n).$$

Here, $o(n)$ is the small oh-notation, which means that asymptotically, the left hand term is smaller than $n$.

Using the approximation $p_n\approx n\ln n$, $$HML=\lim_{n\rightarrow\infty}\left(\frac{o(n)}{n\ln n}\right)=\lim_{n\rightarrow\infty}o\left(\frac{1}{\ln n}\right)=0.$$

• Personally I wouldn't bother with the last three "simplifications" before saying the limit is zero. The first expression is "obviously" $1/g(n)$ where $g(n)$ tends (slowly) to infinity as $n$ tends to infinity Commented Sep 18, 2018 at 7:18
• @MartinBonner: You're right, and I think a few more steps can be removed...
– user193810
Commented Sep 18, 2018 at 7:22

This is a lower-tech alternative to Ross Millikan's answer for the Arithmetic Mean result (not using the hyperactive factorial function...), followed by a proof for the Geometric Mean (which occurred to me later).

Using $p_n\approx n\log n$ for large $n$, we need to prove

$${1\over n^2}\sum_{k=1}^n{k\log k\over\log n}\to{1\over2}$$

But for any $0\lt r\lt1$ we have

$$(1-r)\sum_{k=\lceil n^{1-r}\rceil}^nk\le\sum_{k=1}^n{k\log k\over\log n}\le\sum_{k=1}^nk={n(n+1)\over2}$$

(Note, the lower limit on the lower bounding sum is $k=\lceil n^{1-r}\rceil$; for some reason it doesn't render well in the displayed version on my screen.) Now

$$\sum_{k=\lceil n^{1-r}\rceil}^nk={n(n+1)-(\lceil n^{1-r}\rceil-1)\lceil n^{1-r}\rceil\over2}\ge{n(n+1)-n^{1-r}(n^{1-r}+1)\over2}\ge{n^2\over2}\left(1-{1\over n^{2r}}-{1\over n^{1+r}} \right)\ge{n^2\over2}\left(1-{2\over n^{2r}} \right)$$

It follows that

$${1-r\over2}\left(1-{2\over n^{2r}}\right)\le{1\over n^2}\sum_{k=1}^n{k\log k\over\log n}\le{1\over2}\left(1+{1\over n}\right)$$

Finally, let's let $r=1/\sqrt{\log n}$ Then $n^{2r}=e^{2r\log n}=e^{2\sqrt{\log n}}\to\infty$ as $n\to\infty$. It follows that

$${1-r\over2}\left(1-{2\over n^{2r}}\right)={1-(1/\log n)\over2}\left(1-{2\over e^{2\sqrt{\log n}}}\right)\to{1\over2}$$

and the Squeeze Theorem does the rest.

Added later: The low-tech approach also handles the Geometric Mean. Since $p_n/(n\log n)\to1$ as $n\to\infty$, it suffices to show

$${1\over n}\sum_{k=1}^n\log\left(n\log n\over p_k\right)\to1$$

If we write $p_k=(1+\epsilon_k)k\log k$ (for $k\gt1$) and note that $\epsilon_k\to0$ as $k\to\infty$, and again let $r=1/\sqrt{\log n}$ (with $n\gt2$), we have

$${1\over n}\sum_{k=1}^n\log\left(n\log n\over p_k\right)={1\over n}\sum_{k=1}^{\lfloor n^{1-r}\rfloor}\log\left(n\log n\over p_k\right)+{1\over n}\sum_{k=\lceil n^{1-r}\rceil}^n\log\left(n\log n\over (1+\epsilon_k)k\log k\right)\\ ={1\over n}\sum_{k=1}^{\lfloor n^{1-r}\rfloor}\log\left(n\log n\over p_k\right) -{1\over n}\sum_{k=\lceil n^{1-r}\rceil}^n\log(1+\epsilon_k) +{1\over n}\sum_{k=\lceil n^{1-r}\rceil}^n\log\left(\log n\over\log k\right) -{1\over n}\sum_{k=\lceil n^{1-r}\rceil}^n\log\left(k\over n\right)$$

Now for large $n=e^{u^2}$ (so that $r=1/u$), we have

$$0\lt{1\over n}\sum_{k=1}^{\lfloor n^{1-r}\rfloor}\log\left(n\log n\over p_k\right)\lt{1\over n}\sum_{k=1}^{\lfloor n^{1-r}\rfloor}\log\left(n\log n\over 2\right)\lt{\log(n\log n/2)\over n^r}={u^2+2\log u-\log2\over e^u}\to0$$

and

$$0\lt{1\over n}\sum_{k=\lceil n^{1-r}\rceil}^n\log\left(\log n\over\log k\right)\lt{1\over n}\sum_{k=\lceil n^{1-r}\rceil}^n\log\left(\log n\over\log n^{1-r}\right)\lt\log(1-r)\to0$$

We also have

$$\left|{1\over n}\sum_{k=\lceil n^{1-r}\rceil}^n\log(1+\epsilon_k)\right|\le\max_{\lceil n^{1-r}\rceil\le k\le n}|\log(1+\epsilon_k)|\to0$$

since the range over which the max is taken forces $\epsilon_k\to0$. Finally, we have

$$-{1\over n}\sum_{k=\lceil n^{1-r}\rceil}^n\log\left(k\over n\right) = {1\over n}\sum_{k=1}^{\lfloor n^{1-r}\rfloor}\log\left(k\over n\right) -{1\over n}\sum_{k=1}^n\log\left(k\over n\right)$$

where

$$0\lt{1\over n}\sum_{k=1}^{\lfloor n^{1-r}\rfloor}\log\left(n\over k\right)\lt{\log n\over n^r}={u^2\over e^u}\to0$$

and

$$-{1\over n}\sum_{k=1}^n\log\left(k\over n\right)\to-\int_0^1\log x\,dx=1$$