How many factorial digits are there in 1000? How many consecutive zeros are there?
There is a factorial Formula
For example, 1000 factorial digits:
Log10 (1) + log10 (2) + · + long10 (1000) is rounded up and then added to 1
Or
Log (N !) = LnN! /Ln10
= (NlnN-N)/ln10
= 2565.7
There is a way to get the number of digits of the factorial result, but to calculate N LOG10, the time is not good, so give up this method:
Set the number of digits to x,
Column equation 10 ^ x = N !, Www.2cto.com
Then x = log10 (N !)
Then x = log10 (1) + log10 (2) + log10 (3) +... + log10 (N ),
The final x is rounded up.
//////////////////////////////////////// //////////////////////////////////////
Each time a 2 or 5 appears, there will be a 0 at the end.
The total number of 2 and 5 in 1000 is enough, and because 5 is less than 2, you only need to check the number of approx. 5 In the 1000 factorial. Similarly, only the number with 0 or 5 at the end is 5, so there are only 200 numbers in total, including 5. However, among them, there are 1000/25 = 40 numbers, including 2, 125/625 = 8 numbers, including 3,/= 1 numbers, including 4 5, so there are 200 + 40 + 8 + 1 = 249 5 in total, so there are 249 consecutive 0 in the result.
//////////////////////////////////////// /////////////////////////////////
By fengzhishang2019