login
Gosper's approximation to n!, sqrt((2*n+1/3)*Pi)*n^n/e^n, rounded to nearest integer.
5

%I #32 Feb 24 2023 11:26:18

%S 1,1,2,6,24,120,720,5039,40316,362851,3628561,39914615,478979481,

%T 6226774954,87175314872,1307635379670,20922240412500,355679137660826,

%U 6402240370021199,121642823201649058,2432860847996122437,51090157192742729183,1123984974735953018069

%N Gosper's approximation to n!, sqrt((2*n+1/3)*Pi)*n^n/e^n, rounded to nearest integer.

%H G. C. Greubel, <a href="/A090583/b090583.txt">Table of n, a(n) for n = 0..449</a> (terms 0..200 from Alois P. Heinz)

%H Peter Luschny, <a href="http://oeis.org/wiki/User:Peter_Luschny/FactorialFunction">Approximations to the Factorial Function</a>.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/StirlingsApproximation.html">Stirling's Approximation</a>.

%p Digits:= 2000;

%p a:= n-> round(sqrt((2*n+1/3)*Pi)*n^n/exp(n)):

%p seq(a(n), n=0..30); # _Alois P. Heinz_, Feb 04 2013

%t Join[{1}, Table[Round[Sqrt[(2*n + 1/3)*Pi]*n^n/Exp[n]], {n, 1, 50}]] (* _G. C. Greubel_, Nov 28 2017 *)

%o (PARI) a(n) = round(sqrt((2*n+1/3)*Pi)*n^n/exp(n)); \\ _Bill McEachen_, Aug 16 2014

%o (Magma) C<i> := ComplexField(); [Round(Sqrt((2*n + 1/3)*Pi(C))*n^n/Exp(n)): n in [0..30]]; // _G. C. Greubel_, Nov 28 2017

%Y Cf. A000142, A005394, A055775.

%K nonn

%O 0,3

%A _Hugo Pfoertner_, Jan 10 2004