login
Factorial expansion of sqrt(Pi) = Sum_{n>0} a(n)/n!.
3

%I #22 Sep 08 2022 08:45:05

%S 1,1,1,2,2,4,1,1,3,0,5,10,6,8,12,0,10,0,12,9,6,12,22,21,24,3,14,21,13,

%T 24,21,11,8,22,27,3,8,1,36,21,27,15,2,41,22,34,8,0,4,8,39,48,27,38,22,

%U 0,23,49,19,27,29,28,40,33,21,62,7,67,33,8,30,18,60,73,61,72,42,59,22

%N Factorial expansion of sqrt(Pi) = Sum_{n>0} a(n)/n!.

%H G. C. Greubel, <a href="/A068450/b068450.txt">Table of n, a(n) for n = 1..10000</a>

%e sqrt(Pi) = 1 + 1/2! + 1/3! + 2/4! + 2/5! + 4/6! + 1/7! + ...

%t Table[If[n == 1, Floor[Sqrt[Pi]], Floor[n!*Sqrt[Pi]] - n*Floor[(n - 1)!*Sqrt[Pi]]], {n, 1, 50}] (* _G. C. Greubel_, Mar 21 2018 *)

%o (PARI) default(realprecision, 250); for(n=1,30, print1(if(n==1, floor(sqrt(Pi)), floor(n!*sqrt(Pi)) - n*floor((n-1)!*sqrt(Pi))), ", ")) \\ _G. C. Greubel_, Mar 21 2018

%o (PARI) vector(30,n,if(n>1,t=t%1*n,t=sqrt(Pi))\1) \\ _M. F. Hasler_, Nov 25 2018

%o (Magma) SetDefaultRealField(RealField(250)); R:= RealField(); [Floor(Sqrt(Pi(R)))] cat [Floor(Factorial(n)*Sqrt(Pi(R))) - n*Floor(Factorial((n-1))*Sqrt(Pi(R))) : n in [2..30]]; // _G. C. Greubel_, Mar 21 2018

%o (Sage)

%o def A068450(n):

%o if (n==1): return floor(sqrt(pi))

%o else: return expand(floor(factorial(n)*sqrt(pi)) - n*floor(factorial(n-1)*sqrt(pi)))

%o [A068450(n) for n in (1..80)] # _G. C. Greubel_, Nov 27 2018

%Y Cf. A075874, A002161 (decimal expansion).

%K nonn

%O 1,4

%A _Benoit Cloitre_, Mar 10 2002

%E Keyword cons removed by _R. J. Mathar_, Jul 23 2009