# bernoulli() Function & Examples

Use the bernoulli() probability function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## bernoulli

#### bernoulli(n)

Try it yourself:

```calculio
bernoulli(4)
bernoulli(fraction(12))
```

[combinations](https://calcul.io/function/combinations/index.md)

[gamma](https://calcul.io/function/gamma/index.md)

---

## 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()](https://calcul.io/function/bellNumbers/index.md), [catalan()](https://calcul.io/function/catalan/index.md), and [stirlingS2()](https://calcul.io/function/stirlingS2/index.md). Exact rational results can be converted only at presentation time with For factorial-based combinatorial formulas, use [factorial()](https://calcul.io/function/factorial/index.md).

[All functions](https://calcul.io/functions/index.md)
