In one of my undergrad theory or algorithms classes, I remember a professor sharing a quip that went something like

In practice, $\log(\log(N))$ is at most 9.

...the idea being that even though the function $f(N) = \log(\log(N))$ technically grows without bound, it's tiny for any value of $N$ that's remotely plausible for nearly any real-world problem, so an $O(\log(\log(N))$ algorithm is effectively constant-time. For example, $\log_2(\log_2($number of particles in the universe$)) \approx 8$. (It's even smaller if you use base $e$ or base 10.)

Does anyone know who first (or most famously) said this?

Googling this with various parts in quotes turns up plenty of lecture notes and tutorials about big-O notation and how slowly $\log(N)$ and $\log(\log(N))$ grow, but so far the earliest example I've found is this lecture by Richard Borcherds in 2021, which is several years later than my memory of hearing it (and doesn't cite anyone else as the source of the remark).


2 Answers 2


I don't think this is some historical quote that was famously said by someone, or that needs to be attributed to someone who said it. It is just a mathematical fact. I imagine many people have made a similar observation.

Your question is a little like asking "Who said first that 2+2=4?" You'd probably give me a funny look if I asked that question.

See also Is there a meaningful difference between O(1) and O(log n)?, "For small values of n, O(n) can be treated as if it's O(1)", https://en.wikipedia.org/wiki/Ackermann_function#Inverse (for a similar property of Ackerman's function), https://en.wikipedia.org/wiki/Iterated_logarithm#Analysis_of_algorithms (for a similar fact about the iterated logarithm).


I said it, and many people said it. It’s obvious when n is the size of a problem: if you wanted to sort all bits on all of Google’s hard drives, that’s less than $2^{80}$ bits, log n < 80, log log n < 6.34.

It’s not quite correct when n is a number. For example in a search for Fermat primes, we look at numbers around $2^{70,000,000}$, log n ≈ 70,000,000, log log n < 26.2.

Adding integers less than n takes O(log n), but in practice the time is constant for $n < 2^{64}$.

  • $\begingroup$ "I said it, and many people said it"—can you give a specific example? $\endgroup$
    – futurulus
    Jan 8 at 22:52
  • 1
    $\begingroup$ Two specific examples: OP and I. $\endgroup$
    – gnasher729
    Jan 9 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.