[Ecm-commits] r2682 - trunk
ecm-commits at lists.gforge.inria.fr
Wed Apr 8 13:30:52 CEST 2015
Date: 2015-04-08 13:30:52 +0200 (Wed, 08 Apr 2015)
New Revision: 2682
removed suggestion from Peter Montgomery to start with exponent n-1 in P-1:
it was useful when n = b^m-1 where a prime factor p = k*m+1, to force the
factor m in the exponent. But it was used only when bitsize(n) <= sqrt(B1),
and since m <= bitsize(n) we already had m^2 included in the exponent.
--- trunk/pm1.c 2015-04-07 09:16:25 UTC (rev 2681)
+++ trunk/pm1.c 2015-04-08 11:30:52 UTC (rev 2682)
@@ -167,26 +167,8 @@
if (mpz_fits_uint_p (g))
smallbase = mpz_get_ui (g);
- /* suggestion from Peter Montgomery: start with exponent n-1,
- since any prime divisor of b^m-1 which does not divide any
- algebraic factor of b^m-1 must be of the form km+1 [Williams82].
- Do this only when n is composite, otherwise all tests with prime
- n factor of a Cunningham number will succeed in stage 1.
+ mpz_set_ui (g, 1);
- Since mpz_probab_prime_p and a^(n-1) mod n require about lg(n) modular
- multiplications, and P-1 perform about B1 modular multiplications,
- to ensure small overhead, use that trick only when lg(n) <= sqrt(B1).
- /* For now, this p^N-1 is left in. We might want it out at a later time */
- if ((double) size_n <= B0 &&
- mpz_probab_prime_p (n->orig_modulus, PROBAB_PRIME_TESTS) == 0)
- mpz_sub_ui (g, n->orig_modulus, 1);
- mpres_pow (a, a, g, n);
- mpz_set_ui (g, 1);
/* Set a limit of roughly 10000 * log_10(N) for the primes that are
multiplied up in the exponent, i.e. 1M for a 100 digit number,
but limit to CASCADE_MAX to avoid problems with stack allocation */
More information about the Ecm-commits