bernoulli

bernoulli(n)

Try it yourself:

See also:

bernoulli(): Bernoulli numbers

bernoulli(n) returns the nth Bernoulli number, a sequence of rational constants that appears in series expansions, number theory, and exact summation formulas. The sequence begins 1, −1/2, 1/6, 0, −1/30 when indexed from zero.

Why these numbers matter

Bernoulli numbers correct simple approximations with increasingly precise terms. They occur in the Taylor expansion of functions and in formulas for sums of powers: instead of adding every integer power one by one, a polynomial involving Bernoulli numbers gives the same result. They are also part of Euler–Maclaurin summation, which connects finite sums and integrals.

Examples and constraints

Use non-negative integer indices: bernoulli(0) gives 1 and bernoulli(2) gives 1/6. Most odd-indexed values above 1 are zero, but that pattern should not replace computation in symbolic work. Negative, fractional, or missing indices do not describe a member of the standard sequence.

Related tools

For nearby discrete sequences, see bellNumbers(), catalan(), and stirlingS2(). Exact rational results can be converted only at presentation time with For factorial-based combinatorial formulas, use factorial().

All functions