FLINT3.7.0-dev

n_ll_is_prime

Synopsis#include <flint/ulong_extras.h>
int n_ll_is_prime(ulong nhi, ulong nlo)source

Primality test for the two-limb integer n = n_{hi} B + n_{lo} with n_{hi} \ne 0. Returns 1 (prime), 0 (composite) or -1 (unknown). The answer is always definite below about 2^{81} on 64-bit machines.

For n up to about 81 bits, trial division is followed by a strong probable prime test with the first 13 primes as bases, which proves primality in this range [SorWeb2016]. For larger n, trial division and a base-2 test are done and the function returns 0 or -1; use fmpz_is_prime for a proof. On 32-bit machines the function currently always returns -1.

References#

  • [SorWeb2016] Sorenson, Jonathan and Webster, Jonathan : Strong pseudoprimes to twelve prime bases. Math. Comp. 86 (2017), 985-1003, https://doi.org/10.1090/mcom/3134
Cite this page

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