FLINT3.7.0-dev

n_mod_lemire

Synopsis#include <flint/ulong_extras.h>
ulong n_mod_lemire(ulong x, ulong n, ulong npre)source

Returns x \bmod n using the method of Lemire, Kaser and Kurz [LKK2019]. Only correct for n, x < 2^{\mathtt{FLINT\_BITS} / 2}.

References#

  • [LKK2019] D. Lemire, O. Kaser and N. Kurz, "Faster remainder by direct computation: applications to compilers and software libraries", Software: Practice and Experience 49 (2019), 953–970, https://arxiv.org/abs/1902.01961
Cite this page

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