cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A260657 Rounded error in Stirling's formula: a(n) = round(n! - exp(-n)*n^(n+1/2)*sqrt(2*Pi)).

Original entry on oeis.org

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

Views

Author

Vladimir Reshetnikov, Nov 13 2015

Keywords

Crossrefs

Programs

  • 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}]
  • 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

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