How many numbers $n$ are there such that $\gcd(n,\phi(n)) = 1$?

These numbers are tabulated at the Online Encyclopedia of Integer Sequences. It says, Erdős proved that $a(n) \sim e^{\gamma} n \log \log \log n$ (where $a(n)$ is the $n$th such number). The reference may be Paul Erdős, Some asymptotic formulas in number theory, J. Indian Math. Soc. (N.S.) 12 (1948) 75-78.


This is a follow-up from Gerry's answer, an asymptotic formula with an error term can be found. Let $N(x)$ be the number of $n\leq x$ with the property $(n,\phi(n))=1$. Then

$$ N(x)= \frac x{\log\log\log x}\left(e^{-\gamma}+O\left( \frac{\log\log\log\log x}{\log\log\log x}\right) \right). $$

This is outlined in Chapter 11 of 'Multiplicative Number Theory I' written by H. Montgomery and R. Vaughan. Especially Theorem 11.23 is the result of Erdős. Then in the Chapter 11-exercise 2, such formula is found.

The proof of Theorem 11.23 is consisted of estimates in the three cases. Let $p=p(n)$ be the smallest prime divisor of $n$.

  1. $p\leq \log\log x$.

  2. $\log\log x < p\leq y = (\log\log x)^{1+\epsilon}$.

  3. $y<p\leq x$.

A hint given in the exercise is 'specify $\epsilon$ as a function of $x$'.

We take $\epsilon = \frac{\log\log\log\log x}{\log\log\log x}$, and apply these in the proof of Theorem 11.23. The result follows.

Then the estimate of $n$-th number $a_n$ with $(a_n,\phi(a_n))=1$, is

$$ a_n=\left(e^{\gamma}+O\left(\frac{\log\log\log\log n}{\log\log\log n}\right)\right)n\log\log\log n. $$