Skip to content

Commit

Permalink
Tweak PartialFactorization call when proving primality
Browse files Browse the repository at this point in the history
Namely, by passing it the 'cheap' option (which implies the FactIntPartial
option), as the surrounding code would suggest. This makes calling e.g.

  IsPrimeInt(100000000000000000000000000000000000000000000000151);

with FactInt loaded almost as fast as without it loaded.
  • Loading branch information
fingolfin authored and markuspf committed Jan 17, 2018
1 parent acec523 commit 17cc656
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions hpcgap/lib/primality.gi
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,8 @@ function(N)
# try straightforward method first
if cheap=true and FactIntPartial=true then
to_check:=Concatenation(
List(Set(PartialFactorization(N-1,7)),p->["F",p]),
List(Set(PartialFactorization(N+1,7)),p->["L",p]));
List(Set(PartialFactorization(N-1,7 : cheap)),p->["F",p]),
List(Set(PartialFactorization(N+1,7 : cheap)),p->["L",p]));
if [] <> PrimalityProof_VerifyStructure(N,to_check)
then return to_check;
else Info(InfoPrimeInt,1,"Straightforward Fermat-Lucas primality proof failed on ",N);
Expand Down
4 changes: 2 additions & 2 deletions lib/primality.gi
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,8 @@ function(N)
# try straightforward method first
if cheap=true and FactIntPartial=true then
to_check:=Concatenation(
List(Set(PartialFactorization(N-1,7)),p->["F",p]),
List(Set(PartialFactorization(N+1,7)),p->["L",p]));
List(Set(PartialFactorization(N-1,7 : cheap)),p->["F",p]),
List(Set(PartialFactorization(N+1,7 : cheap)),p->["L",p]));
if [] <> PrimalityProof_VerifyStructure(N,to_check)
then return to_check;
else Info(InfoPrimeInt,1,"Straightforward Fermat-Lucas primality proof failed on ",N);
Expand Down

0 comments on commit 17cc656

Please sign in to comment.