login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A025201 a(n) = floor(log(n!)). 9
0, 0, 1, 3, 4, 6, 8, 10, 12, 15, 17, 19, 22, 25, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 58, 61, 64, 67, 71, 74, 78, 81, 85, 88, 92, 95, 99, 102, 106, 110, 114, 117, 121, 125, 129, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 201, 205, 209, 213, 217, 221, 226 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
COMMENTS
Previous name was: a(n) = floor(sum_{k=1..n} log(k)). - Jon E. Schoenfield, Dec 29 2014
Logarithm of gamma function of n gives essentially the same sequence, only the index is shifted by 1. - Jason Earls, Jun 30 2001
a(n) is the largest integer m such that e^m <= n!. - Stanislav Sykora, May 29 2015
a(n) is within 1 of n*(log(n) - 1) + log(sqrt(2*Pi*n)). - Robert Israel, May 29 2015
Log(n!) ~ n log (n) - n + log(n(1+4n(1+2n)))/6 + log(Pi)/2 [given by Srinivasa Ramanujan, see Ramanujan's Lost Notebook, 1987]. - Robert G. Wilson v, Jun 11 2015
Robert Israel's formula above is Stirling's formula for log(n!). It gives the correct integer part for all n > 1 at least up to 10^6. It is known that the error is between 1/(12n+1) and 1/12n, therefore positive and decreasing to zero. However, log(n!) is never an integer and its fractional part appears to get arbitrarily close to any value in [0,1]. If ever the fractional part of log(n!) would be less than 1/(12n+1), then this approximation would yield a(n)-1 instead of a(n). - M. F. Hasler, Dec 03 2018
REFERENCES
S. Ramanujan, The Lost Notebook and other Unpublished Papers. S. Raghavan and S. S. Rangachari, editors. Narosa, New Delhi, 1987, page 339.
LINKS
FORMULA
a(n) = floor(n*log(n) - n + log(2*Pi*n)/2) (Stirling's approximation) holds for all 1 < n < 10^6, but a counterexample might exist for some larger n. - M. F. Hasler, Dec 03 2018
MAPLE
seq(floor(lnGAMMA(n+1)), n=1..100); # Robert Israel, May 29 2015
MATHEMATICA
Floor[ LogGamma[ Range[ 69] + 1]] (* Harvey P. Dale, Aug 23 2014 and slightly modified by Robert G. Wilson v, Jun 21 2015 to correct index *)
f[n_] := Floor[Log[n!]]; Array[f, 69] (* Robert G. Wilson v, Jun 11 2015 *)
PROG
(PARI) vector(100, n, floor(lngamma(n+1)) ) \\ Joerg Arndt, Dec 30 2014
(PARI) A025201(n)=floor(lngamma(n+1)) \\ floor(n*(log(n)-(n>1))+log(2*Pi*n)/2) is 2-3 times faster but could yield a(n)-1 instead of a(n), if frac(log(n!)) < 1/(12n+1). This doesn't happen up to n = 10^6, though. - M. F. Hasler, Dec 03 2018
(Magma) [Floor(Log(Factorial(n))): n in [1..100]]; // Vincenzo Librandi, May 30 2015
CROSSREFS
Sequence in context: A341340 A242932 A351863 * A071259 A231405 A092137
KEYWORD
nonn
AUTHOR
EXTENSIONS
Simpler name (originally submitted in Formula section) from Mohammed Bouayoun (bouyao(AT)wanadoo.fr), Mar 20 2004 - Jon E. Schoenfield, Dec 29 2014
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 07:38 EDT 2024. Contains 371782 sequences. (Running on oeis4.)