Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

what primality test is used by "is_prime" function over the integer in sage math?

What primality test is used by the "is_prime" function over the integer in sagemath? I have tried to look at this documentation (Sage 9.4 Reference Manual: Algebraic Numbers and Number Fields) and I tried to navigate the github repository, but I was not able to find an answer.

Based on other libraries such as Sympy.isPrime, my guess is that "is_prime" has different behavior based on the number bits of the integer since for small integers, it is easy to check primality using the Sieve of Eratosthenes, but for large integers a probability test such as Miller-Rabin is preferable. Hence, I was wondering if there is a way to get information on the implementation of the "is_prime" function in sage math.