|
|
A034886
|
|
Number of digits in n!.
|
|
44
|
|
|
1, 1, 1, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 18, 19, 20, 22, 23, 24, 26, 27, 29, 30, 31, 33, 34, 36, 37, 39, 41, 42, 44, 45, 47, 48, 50, 52, 53, 55, 57, 58, 60, 62, 63, 65, 67, 68, 70, 72, 74, 75, 77, 79, 81, 82, 84, 86, 88, 90, 91, 93, 95, 97, 99, 101, 102
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,5
|
|
COMMENTS
|
Most counterexamples to the Kamenetsky formula (see below) must belong to A177901.
Noam D. Elkies reported on MathOverflow (see link):
"A counterexample [to Kamenetsky's formula] is n_1 := 6561101970383, with log_10((n_1/e)^n_1*sqrt(2*Pi*n_1) = 81244041273652.999999999999995102483-, but log_10(n_1!) = 81244041273653.000000000000000618508+. [...] n_1 is the first counterexample, and the only one up to 10^14."
a(n) < n iff 2 <= n <= 21;
a(n) = n iff n = 1, 22, 23, 24;
a(n) > n iff n = 0 or n >= 25. (End)
|
|
REFERENCES
|
Martin Gardner, "Factorial Oddities." Ch. 4 in Mathematical Magic Show: More Puzzles, Games, Diversions, Illusions and Other Mathematical Sleight-of-Mind from Scientific American. New York: Vintage, pp. 50-65, 1978
|
|
LINKS
|
|
|
FORMULA
|
a(n) = floor(log(n!)/log(10)) + 1.
Using Stirling's formula we can derive an approximation, which is very fast to compute in practice: ceiling(log_10(2*Pi*n)/2 + n*(log_10(n/e))). This approximation gives the exact answer for 2 <= n <= 5*10^7. - Dmitry Kamenetsky, Jul 07 2008
a(n) = ceiling(log_10(1) + log_10(2) + ... + log_10(n)). - Dmitry Kamenetsky, Nov 05 2010
|
|
MAPLE
|
A034886 := n -> `if`(n<2, 1, `if`(n<6561101970383, ceil((ln(2*Pi)-2*n+ln(n)*(1+2*n))/(2*ln(10))), length(n!))); # Peter Luschny, Aug 26 2011
|
|
MATHEMATICA
|
Join[{1, 1}, Table[Ceiling[Log[10, 2 Pi n]/2 + n*Log[10, n/E]], {n, 2, 71}]]
f[n_] := Floor[(Log[2Pi] - 2n + Log[n]*(1 + 2n))/(2Log[10])] + 1; f[0] = f[1] = 1; Array[f, 72, 0] (* Robert G. Wilson v, Jan 09 2013 *)
|
|
PROG
|
(Haskell)
(PARI) for(n=0, 30, print1(floor(log(n!)/log(10)) + 1, ", ")) \\ G. C. Greubel, Feb 26 2018
(Magma) [Floor(Log(Factorial(n))/Log(10)) + 1: n in [0..30]]; // G. C. Greubel, Feb 26 2018
|
|
CROSSREFS
|
Cf. A137580 (number of distinct digits in n!), A027868 (number of trailing zeros in n!).
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
Explained that the formula is an approximation. Made the formula easier to read. - Dmitry Kamenetsky, Dec 15 2010
|
|
STATUS
|
approved
|
|
|
|