TITLE: Iterated logarithms in analytic number theory
QUESTION [39 upvotes]: As all analytic number theorists know, iterated logarithms ($\log x$, $\log \log x$, $\log \log \log x$, etc.) are prevalent in analytic number theory.  One can give countless examples of this phenomenon.  My question is, can someone give an intuitive account for why this is so?  Specifics regarding any of the famous theorems involving iterated logarithms are welcome.  Many thanks!
EDIT: Thank you so much for the answers so far!  I'm still trying to get a better intuition on how a $\log \log \log$ or $\log \log \log \log$ arises, especially in Littlewood's 1914 proof that $\pi(x)-\operatorname{li}(x) = \Omega_{\pm} \left(\frac{\sqrt{x}\log \log \log x}{\log x}\right) \ (x \to \infty)$ or Montgomery's conjecture that $\limsup_{x \to \infty}\dfrac{\lvert\pi(x)-\operatorname{li}(x)\rvert}{\;\frac{\sqrt{x}\, (\log \log \log x)^2}{\log x}\;}$ is finite and postive.  I admit to knowing nothing (yet) about sieve theory, so I will have to dive into the proof of the prime gap theorem by Tao, Maynard, et. al.  Can someone give a more precise account of how the $\log \log \log$ or $\log \log \log\log$ arises in the proof?  I'm very familiar with why occurrences of $\log \log$ happen, but once you get to $\log \log \log$, I'm still a bit mystified.  Also, is there a good introduction to sieve theory where I could start, or should I just dive right in to the papers on large prime gaps?
FURTHER EDIT: Can someone also explain intuitively the reason for the $\log \log \log$ in Littlewood's theorem?  Historically, was this the first occurrence of a triple log in number theory?

REPLY [8 votes]: One can often attribute this phenomenon to Mertens' product formula:
$$
\prod_{p\le x}\left(1-\frac1p\right)\sim{e^{-\gamma}\over\log x}
$$
Using this fact, we can deduce a minimal order for Euler's totient. That is
$$
\liminf_{n\to\infty}{\varphi(n)\log\log n\over n}=e^{-\gamma}
$$
Using similar tricks, one can obtain a maximal order for divisor sum function:
$$
\limsup_{n\to\infty}{\sigma(n)\over n\log\log n}=e^\gamma
$$
Proofs of these results are available in Hardy & Wright's An Introduction to the Theory of Numbers and Tenenbaum's Introduction to Analytic and Probabilistic Number Theory.