Bernoulli Number Calculator (Compute Bₙ)

JJ Ben-Joseph headshot JJ Ben-Joseph

What are Bernoulli numbers?

Bernoulli numbers are a sequence of rational numbers that appear throughout number theory, combinatorics, and analysis. They are usually written as B0, B1, B2, … and can be defined via the generating function

x ex 1 = n=0 Bn xn n!

In words, the coefficients in the power series expansion of x / (ex − 1) are the Bernoulli numbers. The first few are

A striking pattern is that all odd-index Bernoulli numbers beyond B1 are zero: B3 = B5 = B7 = … = 0. Non-zero even-index values grow quickly in magnitude and alternate in sign.

Historical background

Bernoulli numbers are named after Jacob Bernoulli (1655–1705), who studied them while working on formulas for sums of integer powers. For example, to compute

k=1 n k2

Bernoulli discovered that such sums can be expressed using polynomials in n whose coefficients are built from Bernoulli numbers. Leonhard Euler later extended these ideas and revealed deep links between Bernoulli numbers, special functions, and series expansions.

How the Bernoulli Number Calculator works

This calculator computes the Bernoulli number Bn for a given nonnegative integer n using the Akiyama–Tanigawa algorithm. The method constructs a triangular array of rational numbers and reads off Bn from the last entry in the n‑th row.

Conceptually, the algorithm proceeds as follows:

  1. Choose a nonnegative integer n. The algorithm will compute all Bernoulli numbers up to Bn.
  2. Initialize an array A of length n + 1.
  3. For each m from 0 to n, set A[m] = 1 / (m + 1).
  4. For each m from 1 to n, update A backwards: for k from m down to 1, replace A[k − 1] with k × (A[k − 1] − A[k]).
  5. After the loop, A[0] contains Bm. In particular, after the final step, A[0] is Bn.

This procedure is numerically efficient for moderate n and well suited to an in-browser implementation.

Key formulas involving Bernoulli numbers

Bernoulli numbers appear in many fundamental formulas. Some of the most important include:

Using the Bernoulli Number Calculator

The form above is designed to be simple:

  1. Enter a nonnegative integer n in the input field.
  2. Submit the form to compute Bn.
  3. The calculator returns the Bernoulli number Bn. Implementations often provide both a rational representation (numerator and denominator) and, optionally, a decimal approximation.

In many contexts you only need a few initial values, for example B0 through B10. However, the algorithm can handle considerably larger n before numerical precision or performance become issues.

Interpreting the results

When you compute Bn, keep the following patterns in mind:

If your result is zero for an odd n ≥ 3, that is expected and reflects a deep symmetry of the generating function. If your result has a large numerator and denominator, that is also normal: Bernoulli numbers quickly become complicated rationals.

Worked example

Suppose you want to compute B4 using the calculator.

  1. Set n = 4 in the input field.
  2. The calculator runs the Akiyama–Tanigawa algorithm internally and returns B4 = −1/30.

You can verify this value using the generating function. Expanding x / (ex − 1) as a power series gives

x ex 1 = 1 x2 + x212 x4720 +

Comparing this with the defining expansion

n=0 Bn xn n!

shows that B4/4! = −1/720, so B4 = −1/30, matching the calculator output.

Sample values and parity pattern

The table below lists several initial Bernoulli numbers and highlights the vanishing of odd indices beyond B1.

n Bn Non-zero? Sign
01YesPositive
1−1/2YesNegative
21/6YesPositive
30NoZero
4−1/30YesNegative
50NoZero
61/42YesPositive
70NoZero
8−1/30YesNegative
90NoZero
105/66YesPositive

Only even indices (plus n = 1) yield non-zero Bernoulli numbers. This pattern is closely related to the symmetry of the generating function x / (ex − 1) around the origin.

Applications of Bernoulli numbers

Bernoulli numbers are used in many areas:

Limitations and assumptions of this calculator

While the Akiyama–Tanigawa algorithm is efficient, any practical implementation must work within numeric and performance limits. Typical assumptions and constraints include:

For research-grade or very high-index computations, dedicated computer algebra systems or arbitrary-precision libraries are recommended.

Visualising Bernoulli numbers

Although this page focuses on numerical computation rather than plotting, you can export values and create your own charts in external tools. If you plot Bn against n, you will see an alternating pattern of positive and negative spikes at even indices and zeros at most odd indices. If you instead plot |Bn| on a logarithmic scale, you will notice that the points lie close to a straight line, indicating an almost exponential growth in magnitude.

These visual patterns help explain why only a few Bernoulli numbers significantly contribute to many practical formulas: higher-order terms become very large but are also multiplied by high powers or factorials, so their net effect is controlled.

Enter n to compute.

Embed this calculator

Copy and paste the HTML below to add the Bernoulli Number Calculator - Compute B_n Quickly to your website.