Equations (24.5.3) and (24.5.4) enable ${B}_{n}$ and ${E}_{n}$ to be computed by recurrence. For higher values of $n$ more efficient methods are available. For example, the tangent numbers ${T}_{n}$ can be generated by simple recurrence relations obtained from (24.15.3), then (24.15.4) is applied. A similar method can be used for the Euler numbers based on (4.19.5). For details see Knuth and Buckholtz (1967).
Another method is based on the identities
24.19.1 | $${N}_{2n}=\frac{2(2n)!}{{(2\pi )}^{2n}}\left(\prod _{p-1|2n}p\right)\left(\prod _{p}\frac{{p}^{2n}}{{p}^{2n}-1}\right),$$ | ||
24.19.2 | ${D}_{2n}$ | $={\displaystyle \prod _{p-1|2n}}p,$ | ||
${B}_{2n}$ | $={\displaystyle \frac{{N}_{2n}}{{D}_{2n}}}.$ | |||
If ${\stackrel{~}{N}}_{2n}$ denotes the right-hand side of (24.19.1) but with the second product taken only for $p\le \lfloor {(\pi \mathrm{e})}^{-1}2n\rfloor +1$, then ${N}_{2n}=\lceil {\stackrel{~}{N}}_{2n}\rceil $ for $n\ge 2$. For proofs and further information see Fillebrown (1992).
For number-theoretic applications it is important to compute ${B}_{2n}\phantom{\rule{0.949em}{0ex}}(modp)$ for $2n\le p-3$; in particular to find the irregular pairs $(2n,p)$ for which ${B}_{2n}\equiv 0\phantom{\rule{0.949em}{0ex}}(modp)$. We list here three methods, arranged in increasing order of efficiency.
Tanner and Wagstaff (1987) derives a congruence $(modp)$ for Bernoulli numbers in terms of sums of powers. See also §24.10(iii).
Buhler et al. (1992) uses the expansion
24.19.3 | $$\frac{{t}^{2}}{\mathrm{cosh}t-1}=-2\sum _{n=0}^{\mathrm{\infty}}(2n-1){B}_{2n}\frac{{t}^{2n}}{(2n)!},$$ | ||
and computes inverses modulo $p$ of the left-hand side. Multisectioning techniques are applied in implementations. See also Crandall (1996, pp. 116–120).