FLINT3.7.0-dev

bernoulli_rev_t

Synopsis#include <flint/bernoulli.h>
bernoulli_rev_t

An iterator that generates the even-indexed Bernoulli numbers Bn,Bn−2,Bn−4,…,B0B_n, B_{n-2}, B_{n-4}, \ldots, B_0 in decreasing order, without caching. An array of length one of bernoulli_rev_struct, whose field n is the index of the next number; the rest of the state is private.

The numbers are computed from the zeta function, in batches of 16 consecutive indices (8 below n=4000n = 4000): one pass over a table of the odd powers j−nj^{-n} in fixed point, each multiplied by j2j^2 per step [Blo2009], gives the zeta values of the whole batch, and each number is then the product of the prefactor 2 n!/(2π)n2\, n!/(2\pi)^n, kept as a floating-point number, by ζ(n)\zeta(n), rounded to an integer with a certified error bound. The precision and the number of terms decrease as nn decreases. With several threads (flint_set_num_threads), the numbers of a batch are computed in parallel, together with the table pass of the next batch; the threads are requested when a batch starts, so that the iterator runs serially if none are free (for example inside another parallel computation). See The reverse iterator.

References#

Cite this page

The FLINT team, “bernoulli_rev_t (bernoulli.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/bernoulli/bernoulli_rev_t.html (generated 2026-11-20).