How fast does the coprime probability converge to $6/\pi^2$?

140 Views Asked by At

It is known that the probability that two positive integers are coprime is $6/\pi^2$. This is an amazing result. I wanted to see experimentally how the probability converges to $6/\pi^2$, but I found that the sequence converges terribly slow, and I would not believe that it converges unless I didn't know a proof that it actually does.

Let $a(n)$ be the number of pairs $1 \leq a,b \leq n$ with $\mathrm{gcd}(a,b)=1$. The "probability" in question is defined as a natural density here by $$\lim_{n\to \infty} a(n)/n^2.$$ It evaluates to $6/\pi^2$. For computations it should be useful to have the formula $$a(n) = 1 + 2 \sum_{a=2}^{n} \varphi(a),$$ where $\varphi$ is the Euler totient function. I wrote a little program that computes the values of $a(n)/n^2$, or actually $n \sqrt{6/a(n)}$ since that value should converge to $\pi$, and I would like to see the digits of $\pi$ coming out. Here is a typical excerpt from the sequence (for $10000 \leq n \leq 10005$):

3.141534239016629
3.141342469859083
3.14148445699957
3.14135604503421
3.1414222455373713
3.14148184775969

The sequence "wiggles" and takes "forever" to get close to 3.14159... . Why is that? More precisely:

  1. What is the "convergence speed" of that sequence? This would be formalized with the order of convergence.
  2. If $d \geq 1$, is there some $n_0$ such that for all $n \geq n_0$ the number $n \sqrt{6/a(n)}$ has the first $d$ digits of $\pi$? For example, is this true for $d=4$, so that we have 3.1415... from some point on? Numerical experiments suggest that this indeed the case, but $n_0$ is very large.
  3. A bit more broader: can we adjust the sequence slightly, or at least find a different sequence related to the coprimality of integers, that converges to $\pi$ more fast?