# Any number can start a factorial

Any positive number can be found at the beginning of a factorial. That is, for every positive positive integer n, there is an integer m such that the leading digits of m! are the digits of n.

There’s a tradition in math to use the current year when you need an arbitrary numbers; you’ll see this in competition problems and recreational math articles. So let’s demonstrate the opening statement with n = 2019. Then the smallest solution is m = 3177, i.e.

3177! = 2019…000

The factorial of 3177 is a number with 9749 digits, the first of which are 2019, and the last 793 of which are zeros.

The solution m = 3177 was only the first. The next solution is 6878, and there are infinitely more.

Not only does every number appear at the beginning of a factorial, it appears at the beginning of infinitely many factorials.

We can say even more. Persi Diaconis proved that factorials obey Benford’s law, and so we can say how often a number n appears at the beginning of a factorial.

If a sequence of numbers, like factorials, obeys Benford’s law, then the leading digit d in base b appears with probability

logb(1 + 1/d).

If we’re interested in 4-digit numbers like 2019, we can think of these as base 10,000 digits . This means that the proportion factorials that begin with 2019 equals

log10000(1 + 1/2019)

or about 1 in every 18,600 factorials.

By the way, powers of 2 also obey Benford’s law, and so you can find any number at the beginning of a power of 2. For example,

22044 = 2019…

Related: Benford’s law blog posts

 As pointed out in the comments, this approach underestimates the frequency of factorials that start with 2019. It would count numbers of the form 2019 xxxx xxxx, but not numbers of the form 201 9xxx xxxx etc. The actual frequency would be 4x higher.

## One thought on “Any number can start a factorial”

1. Agostino

Hey, this post is very interesting, however there’s a mistake in the way you compute the proportion of factorials that begin by “2019”.
TL;DR
The correct formula is with log base 10, not base 10000 and the final result is 4 times smaller: 4650 instead of 18600.
———–
A number that begins by digits “2019” (in base 10), in your hypothetical base 10,000 can begin by “2”, “20”, “201” or “2019” so you should take taht into account. Your reasoning is tantamount to saying that the integers that begin by digit “4” in base 10 are the integers that begin by “10” in their binary representation… As another example let’s have a hypothetical base 100: the integers that begin by “25” in base 10 are NOT ONLY the ones that begin by digit “25” in base 100: the integers that begin by “25” in base 10 are those that begin by digit “25” in base 100 PLUS those that begin by “2” (base 100) and whose second digit is “50”, “51”,… or “59”….
So in order to assess the number of factorials that begin by “2019” you can’t use this hypothetical base 10,000 but rather the generalized Benford’s law for digits beyond the first.