diff options
-rw-r--r-- | THANKS.in | 1 | ||||
-rw-r--r-- | src/factor.c | 9 |
2 files changed, 6 insertions, 4 deletions
@@ -608,7 +608,6 @@ Tony Leneis tony@plaza.ds.adp.com Tony Robinson ajr@eng.cam.ac.uk Toomas Soome Toomas.Soome@Elion.ee Toralf Förster toralf.foerster@gmx.de -Torbjorn Granlund tege@nada.kth.se Torbjorn Lindgren tl@funcom.no Torsten Landschoff torsten@pclab.ifg.uni-kiel.de Travis Gummels tgummels@redhat.com diff --git a/src/factor.c b/src/factor.c index 1d5580507..e63e0e01d 100644 --- a/src/factor.c +++ b/src/factor.c @@ -153,6 +153,9 @@ factor_using_division (mpz_t t, unsigned int limit) mpz_clear (r); } +/* The number of Miller-Rabin tests we require. */ +enum { MR_REPS = 25 }; + static void factor_using_pollard_rho (mpz_t n, int a_int) { @@ -222,7 +225,7 @@ S4: mpz_div (n, n, g); /* divide by g, before g is overwritten */ - if (!mpz_probab_prime_p (g, 3)) + if (!mpz_probab_prime_p (g, MR_REPS)) { do { @@ -242,7 +245,7 @@ S4: mpz_mod (x, x, n); mpz_mod (x1, x1, n); mpz_mod (y, y, n); - if (mpz_probab_prime_p (n, 3)) + if (mpz_probab_prime_p (n, MR_REPS)) { emit_factor (n); break; @@ -411,7 +414,7 @@ print_factors_multi (mpz_t t) if (mpz_cmp_ui (t, 1) != 0) { debug ("[is number prime?] "); - if (mpz_probab_prime_p (t, 3)) + if (mpz_probab_prime_p (t, MR_REPS)) emit_factor (t); else factor_using_pollard_rho (t, 1); |