This site is supported by donations to The OEIS Foundation.

 Please make a donation to keep the OEIS running. We are now in our 55th year. In the past year we added 12000 new sequences and reached 8000 citations (which often say "discovered thanks to the OEIS"). We need to raise money to hire someone to manage submissions, which would reduce the load on our editors and speed up editing. Other ways to donate

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A025201 a(n) = floor(log(n!)). 9

%I

%S 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,

%T 61,64,67,71,74,78,81,85,88,92,95,99,102,106,110,114,117,121,125,129,

%U 132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,201,205,209,213,217,221,226

%N a(n) = floor(log(n!)).

%C Previous name was: a(n) = floor(sum_{k=1..n} log(k)). - _Jon E. Schoenfield_, Dec 29 2014

%C Logarithm of gamma function of n gives essentially the same sequence, only the index is shifted by 1. - _Jason Earls_, Jun 30 2001

%C a(n) is the largest integer m such that e^m <= n!. - _Stanislav Sykora_, May 29 2015

%C a(n) is within 1 of n*(log(n) - 1) + log(sqrt(2*Pi*n)). - _Robert Israel_, May 29 2015

%C 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

%C 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

%D S. Ramanujan, The Lost Notebook and other Unpublished Papers. S. Raghavan and S. S. Rangachari, editors. Narosa, New Delhi, 1987, page 339.

%H Robert Israel, <a href="/A025201/b025201.txt">Table of n, a(n) for n = 1..10000</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Stirling%27s_approximation#Speed_of_convergence_and_error_estimates">Stirling's approximation: Speed of convergence and error estimates</a>.

%F a(n) = floor(n*log(n) - n + log(2*Pi*n)/2) (Stirling's approximation) holds for all 1 < n < 10^6, but a counter-example might exist for some larger n. - _M. F. Hasler_, Dec 03 2018

%p seq(floor(lnGAMMA(n+1)),n=1..100);# _Robert Israel_, May 29 2015

%t 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 *)

%t f[n_] := Floor[Log[n!]]; Array[f, 69] (* _Robert G. Wilson v_, Jun 11 2015 *)

%o (PARI) vector(100, n, floor(lngamma(n+1)) ) \\ _Joerg Arndt_, Dec 30 2014

%o (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

%o (MAGMA) [Floor(Log(Factorial(n))): n in [1..100]]; // _Vincenzo Librandi_, May 30 2015

%Y Cf. A001113, A046654.

%K nonn

%O 1,4

%A _Clark Kimberling_

%E Simpler name (originally submitted in Formula section) from Mohammed Bouayoun (bouyao(AT)wanadoo.fr), Mar 20 2004 - _Jon E. Schoenfield_, Dec 29 2014

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

Last modified December 15 03:48 EST 2019. Contains 329990 sequences. (Running on oeis4.)