n_is_prime_pocklington
#include <flint/ulong_extras.h>Most of the time goes into factoring with n_factor_partial (trial division, then Hart's one-line algorithm [Har2012] or SQUFOF), which stops once the factored part of is at least . If , the cube root criterion of Brillhart, Lehmer and Selfridge is applied in addition. Then, for each prime dividing , n_is_prime_pocklington tries the bases until , returning 0 if some and if no base works. Finally it checks that is coprime to the product of the values . In most cases a larger number of iterations hardly affects the running time.
References#
- [Poc1914] H. C. Pocklington, "The determination of the prime or composite nature of large numbers by Fermat's theorem", Proceedings of the Cambridge Philosophical Society 18 (1914), 29–30
- [BLS1975] J. Brillhart, D. H. Lehmer and J. L. Selfridge, "New primality criteria and factorizations of 2^m ± 1", Mathematics of Computation 29 (1975), 620–647
- [Har2012] Hart, William B.. (2012) A one line factoring algorithm. Journal of the Australian Mathematical Society, Volume 92 (Number 1). pp. 61-69.
The FLINT team, “n_is_prime_pocklington (ulong_extras.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/ulong_extras/n_is_prime_pocklington.html (generated 2026-11-02).
@misc{flint-doc-ulong-extras-n-is-prime-pocklington,
author = {{The FLINT team}},
title = {{n\_is\_prime\_pocklington (ulong\_extras.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/ulong_extras/n_is_prime_pocklington.html},
note = {Generated 2026-11-02}
}