FLINT3.7.0-dev

fmpz_is_prime_pocklington, fmpz_is_prime_morrison

Synopsis#include <flint/fmpz.h>
int fmpz_is_prime_pocklington(fmpz_t F, fmpz_t R, const fmpz_t n, nn_ptr pm1, slong num_pm1)source
int fmpz_is_prime_morrison(fmpz_t F, fmpz_t R, const fmpz_t n, nn_ptr pp1, slong num_pp1)source

The n−1n - 1 test of Pocklington and the n+1n + 1 test of Morrison for odd nn (non-square for Morrison), given the num_pm1 (num_pp1) primes pm1 (pp1) dividing n−1n - 1 (n+1n + 1). Return 0 if nn is composite. Otherwise they set FF to the factored part of n∓1n \mp 1 and RR to (n∓1)/F(n \mp 1)/F and return 1, which proves that every prime factor of nn is ≡1(modF)\equiv 1 \pmod F (respectively ≡±1\equiv \pm 1). This proves nn prime if F≥nF \ge \sqrt n (respectively F>n+1F > \sqrt n + 1).

Cite this page

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