Ask Your Question
0

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

asked 2024-07-08 18:35:14 +0200

vxek gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2024-07-08 22:43:51 +0200

According to the Sage reference manual, this method calls "the PARI function isprime". That function is documented here; I could be wrong, but I think that Sage calls it without specifying a flag, so flag assumes the default value of 0.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-07-08 18:35:14 +0200

Seen: 226 times

Last updated: Jul 08