FLINT3.7.0-dev

aprcl_is_prime_final_division

Synopsis#include <flint/aprcl.h>
int aprcl_is_prime_final_division(const fmpz_t n, const fmpz_t s, ulong r)source

The final step of the test: given that every divisor of nn is congruent to ni mod sn^i \bmod s for some 0≤i<r0 \le i < r, and gcd⁡(n,s)=1\gcd(n, s) = 1, returns 0 if nn is divisible by one of the residues a=ni mod sa = n^i \bmod s with 1<a≤n1 < a \le \sqrt n, 1≤i<r1 \le i < r, and 1 otherwise. If s2>ns^2 > n, a return value of 1 proves that nn is prime. The walk through the residues is parallelised when threads are available.

Cite this page

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