# A beautiful limit involving primes and composites

I observed the following limit empirically. Let $p_n$ be the $n$-th prime and $c_n$ be the $n$-th composite number then,

$$\lim_{n \to \infty}\frac{1}{n}\sum_{i=1}^{n}\frac{p_n c_n}{p_n c_n + p_i c_i} = \frac{\pi}{4}.$$

I am looking for a proof.

-
How "empirically"? Have you developed a computer program so as to check what happens with $\;n=100\,,\,1000\,,\,....$ ? – DonAntonio May 30 '13 at 10:25
Yes, for the first 1 million primes. – user60930 May 30 '13 at 11:00
That's a very nice check. Read below my answer the comment by Shreevatsa: I think he's got a point there. – DonAntonio May 30 '13 at 11:01

It turns out that

1. The limit is correct, but
2. It's not saying anything that's very special to primes and composites.

Note that (inspired by DonAntonio's answer) $$\lim_{n\to\infty} \frac1n \sum_{k=1}^n \frac{n^2}{n^2 + k^2} = \lim_{n\to\infty} \frac1n \sum_{k=1}^n \frac{1}{1 + \left(\frac{k}{n}\right)^2} = \int_{0}^{1} \frac{dx}{1 + x^2} = \frac{\pi}{4}$$

It just so happens that $p_n$ and $c_n$ are (at a very loose level of approximation) on the order of $n$ each, so that $p_n c_n$ is of the order of $n^2$, and therefore your sum $$\frac{1}{n}\sum_{k=1}^{n}\frac{p_n c_n}{p_n c_n + p_k c_k} \approx \frac{1}{n}\sum_{k=1}^{n}\frac{n^2}{n^2 + k^2},$$ the approximation turning exact in the limit.

To prove this rigorously, we have from the prime number theorem, that $p_n \sim n\ln n$, or to be precise $$p_n = n\left(\ln n + \ln\ln n - 1 + O\left(\frac{\ln\ln n}{\ln n}\right)\right) = n\left(\ln n + o(\ln n)\right).$$ Similarly for the $n$th composite number $c_n$, we have $$c_n = n\left(1 + \frac1{\ln n} + O\left(\frac{1}{\ln^2 n}\right)\right) = n\left(1 + o(1)\right).$$

So $$p_nc_n = n^2\left( \ln n + o(\ln n) \right).$$

Consider a particular value of $\frac{k}{n}$ (say $\alpha$) so that $k = \alpha n$. Then $$\frac{p_kc_k}{p_nc_n} = \frac{k^2 (\ln k + o(\ln k))}{n^2(\ln n + o(\ln n))} = \frac{k^2}{n^2}\frac{\ln n + \ln \alpha + o(\ln n)}{\ln n + o(\ln n)} = \frac{k^2}{n^2}(1 + o(1))$$

Therefore $$\lim_{n\to\infty} \frac{1}{n}\sum_{k=1}^{n}\frac{p_n c_n}{p_n c_n + p_k c_k} = \lim_{n\to\infty} \frac{1}{n}\sum_{k=1}^{n}\frac{1}{1 + \frac{p_k c_k}{p_nc_n}} = \lim_{n\to\infty} \frac{1}{n}\sum_{k=1}^{n}\frac{1}{1 + \frac{k^2}{n^2}(1 + o(1))} = \int_{0}^{1} \frac{dx}{1 + x^2} = \frac{\pi}{4}.$$

-
+1 Beautiful analysis – cyclochaotic May 30 '13 at 13:26
Actually we can probably get away with an even looser analysis. It's an interesting reverse question: what is the loosest "nice" condition on a sequence of numbers $a_n$, which guarantees that $\displaystyle \lim_{n\to\infty} \frac{1}{n} \sum_{k=1}^{n} \frac{a_n}{a_n + a_k} = \frac{\pi}{4}$? – ShreevatsaR May 30 '13 at 13:38
I thank you for mentioning in your overwhelming beautiful answer but that's way too modest from you. Too bad one can upvote only once. +1 – DonAntonio May 30 '13 at 17:16
@ShreevatsaR : Partial answers to the general sequence $a_n$ is present in the following question. Can you have a shot at this bounty question? math.stackexchange.com/questions/403679/… – user60930 May 31 '13 at 5:35

We have that

$$\lim_{n\to\infty}\,\frac1n\,\sum_{k=1}^n\frac n{n+k}=\lim_{n\to\infty}\,\frac1n\,\sum_{k=1}^n\frac1{1+\frac kn}=\int\limits_0^1\frac{dx}{1+x}=\log 2$$

Your sum is not, of course, the above one, but it ressembles it a little, so I'd expect its sum to be closer to $\,\log 2\,$ than to $\,\pi/4\,$ , in particular since the difference between these two numbers is less than $\,1/100\,$ , yet I cannot tell for sure.

A simple program that can add automatically can make some checkings...

-
Note that $\displaystyle \lim_{n\to\infty} \frac1n \sum_{i=1}^n \frac{n^2}{n^2 + i^2} = \int_{0}^{1} \frac{dx}{1 + x^2} = \frac{\pi}{4}$. I think this limit may be more relevant. :-) – ShreevatsaR May 30 '13 at 10:44
Oh, I think you're right, @ShreevatsaR . Why won't you post this as an answer? I would upvote it... – DonAntonio May 30 '13 at 10:55
Still I think this was the germ of the idea, that the answer was an artifact of summation rules. +1. – daniel May 30 '13 at 15:34