10

This is a follow up to First digit of 3^2020

Can you find the first digit of 2020! (factorial) without a computer?

Dmitry Kamenetsky
  • 35,897
  • 5
  • 66
  • 276

2 Answers2

8

I believe it's

3

Because

We know, that for sufficiently large $n$ we have $n!\approx \sqrt{2\pi n}\ n^n/\exp n$. Applying logarithm, we get $\log n! \approx n\log n - n + \frac12 \log 2\pi n$, or $\log_{10} n! \approx n(\log n - 1)/\log 10+\frac12\log_{10} 2\pi n$. For $n=2020$, we get $\log_{10} 2020!\approx 5801.58667 $. Raising 10 to the power of mantissa (0.58667), we get about 3.861, so the first digit is 3.

Notice

Checking in Python (for example) does show that $2020!$ does indeed start with 3, but nevertheless, the $n!\approx \sqrt{2\pi n}\ n^n/\exp n$ approximate equality must be used with great care, since it says that it will hold for sufficiently large $n$, but in no way does it specify how large must $n$ be to achieve reasonable accuracy. Additionally, numbers may be very close but nevertheless start with different digits, when both are "close" to a digit multiplied by a power of 10 (e.g. 29999 and 30001 are within 0.007% of each other, but start with different digits, both being close to 30000).

trolley813
  • 11,282
  • 2
  • 25
  • 57
  • 1
    We can also use the Stirling given here to bound the error: https://en.wikipedia.org/wiki/Stirling%27s_approximation#Speed_of_convergence_and_error_estimates – sunfishho Apr 16 '20 at 06:23
  • Ummm... how did you get $\log_{10} 2020 \approx 5799.53491$ "without a computer" (as demanded by the problem)? – David G. Stork Apr 16 '20 at 06:27
  • 1
    @im_so_meta_even_this_acronym Oh, thanks. Actually I forgot about the $\sqrt{2\pi n}$ factor, but fortunately it starts with a 1. – trolley813 Apr 16 '20 at 06:27
  • 1
    @DavidG.Stork Well, it can be calculated either with a simple calculator (even with one which does only +-*/, because logarithms can be computed by summing series). Alternate way is to use a table of logarithms and calculate it by hand (since the numbers involved are not too large). – trolley813 Apr 16 '20 at 06:29
  • Great answer. Need to be careful with Stirling's approximation as it has an error for smaller values and it needs to be taken into account. – Dmitry Kamenetsky Apr 16 '20 at 06:37
  • 2
    @im_so_meta_even_this_acronym Thanks! I've updated my answer with account to $\sqrt{2\pi n}$ factor, it did not change significantly but became closer. – trolley813 Apr 16 '20 at 06:39
  • @DavidG.Stork My comment really belongs in chat, but chat doesn't seem to support MathJax. I assume you mean $\log_{10}(2020!)$. I can get a back-of-the-envelope (literally, I didn't have any other scrap paper) estimate of $5606$ as follows: $\log_{10}(2020!) = \sum_{i=1}^{2020} log_{10}i = \sum_1^9 log_{10}i + \sum_{10}^{99} log_{10}i + \sum_{100}^{999} log_{10}i + \sum_{1000}^{2020} log_{10}i = 9(0 + w_i) + 90(1 + x_i) + 900(2 + y_i) + 1021(3 + z_i) = 4953 + 9w_i + 90x_i + 900y_i + 1021z_i.$ ... – shoover Apr 16 '20 at 18:06
  • ... Since we're estimating, we can assume that the $w_i, x_i, y_i$ average to $0.5$, so now we've got $\log_{10}(2020!)\approx 4953 + 999(0.5) + 1021z_i$ or $\log_{10}(2020!)\approx 5452.5 + 1021z_i.$ Since $log_{10}2\approx 0.3$, let's assume the $z_i$ average to $0.15$, so now we've got $\log_{10}(2020!)\approx 5452.5 + 1021(0.15)$, which we can work out on our envelope, after rounding up, is $\approx 5606$. Which is probably close enough for the puzzle. – shoover Apr 16 '20 at 18:06
3

$3$

Because:

$\ln 2020!=\sum_\limits{k=2}^{2020} \ln k \approx13358.65$.

$e^{13358.65}\approx 3.8724041499\times10^{5801}$.

JMP
  • 35,612
  • 7
  • 78
  • 151
  • @Glorfindel; Microsoft's for Windows 10: https://www.microsoft.com/en-us/p/windows-calculator/9wzdncrfhvn5?activetab=pivot:overviewtab – JMP Apr 16 '20 at 08:26
  • Nice! The built-in calculator for Mac refuses to do it, and so does Google: https://www.google.com/search?client=firefox-b-d&q=exp+13358.65 – Glorfindel Apr 16 '20 at 08:27
  • I just noticed it also 'just' calculates 2020! without problems ... – Glorfindel Apr 16 '20 at 10:28
  • @Glorfindel; yeah, it's ok to 3248!. – JMP Apr 17 '20 at 02:59