# The number of digits in n! (Part 2)

The following graph shows the number of digits in $n!$ as a function of $n$.

When I was in school, I stared at this graph for weeks, if not months, trying to figure out an equation that would fit these points. And I never could figure it out.

In retrospect, my biggest mistake was thinking that the formula had to be something like $y = a x^m$, where the exponent $m$ was a little larger than 1. After all, the graph is clearly not a straight line, but it’s also not as curved as a parabola.

What I didn’t know then, but know now, is that there’s a really easy way to determine to determine if a data set exhibits power-law behavior. If $y = a x^m$, then

$\ln y = \ln a + m \ln x$.

If we make the substitutions $Y = \ln Y$, $B = \ln a$, and $X = \ln x$, then this equation becomes

$Y = m X + B$

In other words, if the data exhibits power-law behavior, then the log-transformed data would look very much like a straight line. Well, here’s the graph of $(X,Y)$ after applying the transformation:

Ignoring the first couple of pots, the dots show an ever-so-slight concave down pattern, but not enough that would have discouraged me from blindly trying a pattern like $y = a x^m$. However, because these points do not lie on a straight line and exhibit heteroscedastic behavior, my adolescent self was doomed to failure.

## One thought on “The number of digits in n! (Part 2)”

This site uses Akismet to reduce spam. Learn how your comment data is processed.