A beautiful limit involving primes and composites

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}. $$


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...