login
A260657
Rounded error in Stirling's formula: a(n) = round(n! - exp(-n)*n^(n+1/2)*sqrt(2*Pi)).
1
1, 0, 0, 0, 0, 2, 10, 60, 418, 3343, 30104, 301175, 3314114, 39781325, 517289459, 7243645801, 108675472777, 1739099429899, 29569079533691, 532313816538037, 10115161415506606, 202324846199795597, 4249233149373416698, 93491368355657653179, 2150474710445177712523
OFFSET
0,6
LINKS
FORMULA
a(n) ~ exp(-n)*n^(n-1/2)*sqrt(2*Pi)/12.
a(n) = A000142(n) - A005394(n). - Alois P. Heinz, Jan 24 2024
MAPLE
a:= n-> n!-round(sqrt(2*Pi*n)*(n/exp(1))^n):
seq(a(n), n=0..25); # Alois P. Heinz, Jan 24 2024
MATHEMATICA
Table[Round[n! - Exp[-n] n^(n+1/2) Sqrt[2 Pi]], {n, 0, 24}]
PROG
(Sage)
def a(n): # Throws an error if result could not be computed exactly.
rif = RealIntervalField(max(4, 10*n))
r = rif(factorial(n)-(n^(1/2+n)*sqrt(2*pi))/exp(n))
return r.unique_round()
for n in (0..100): print(n, a(n)) # b-file style; Peter Luschny, Nov 18 2015
CROSSREFS
Sequence in context: A372578 A098616 A082042 * A079856 A073329 A290446
KEYWORD
nonn
AUTHOR
STATUS
approved