How find the positive numbers $n$ such that $n!=\overline{1999a_{1}a_{2}\cdots a_{k}\cdots}$

101 Views Asked by At

Question:

find all the postive integer $n$ such $$n!=\overline{1999a_{1}a_{2}\cdots a_{k}\cdots}$$ where $a_{i}\in[0,9]$ (or mean $n!$ left-most four digits are $1999$)

I think $$n!\approx\dfrac{n^n}{e^n}\sqrt{2n\pi}?$$

I have use computer found $n!<10^8$ does not exist. So maybe this $n$ does not exist?

2

There are 2 best solutions below

3
On

Using a computer$^*$ we can find that $$15998! = 1999638128545238518 \dots$$

($^*$) Haskell one-liner:

find (\(a,xs) -> take 4 (show xs) == "1999") $ zip [0..] (scanl (*) 1 [1..])

0
On

Here's a quick solution to this in R $($although it depends on floating-point arithmetic$)$:

n = log(1:100000, 10)
logf = cumsum(n)
first.four = floor(10^(logf-floor(logf))*1000)
which(first.four == 1999)

The output is

15998  19796  20030  20678  24284  25809  28019 
28956  30752  31432  33289  38840  51822  52487 
53962  56006  56660  59986  69481  69557  70232 
88184  94462

which are the numbers less than $10^5$ whose factorials begin with $1999$.

$($Note that this isn't perfect, because of the floating-point dependence; for example it tells me that the first four digits of $4!$ are $2399$, not $2400.)$

Incidentally, factorials obey Benford's Law and so you'd expect that about $\log_{10} 2 - \log_{10} 1.999 \approx$ $\approx 0.00022$ of factorials, in the long run, would start with the digits $1999$. There are $23$ here.