GMP used during 3 and a half years to solve MIT's LCS35

Marco Bodrato bodrato at mail.dm.unipi.it
Wed May 1 04:27:02 UTC 2019


Ciao!

Il 2019-04-30 21:46 Bernard Fabrot ha scritto:
> By the way I've got a question for you...
> 
> When I tested, for squaring, I think I remember it was slightly faster 
> to
> do:
>       mpz_mul(a,a,a);
>       mpz_mod(a,a,n);
> manually then to call the modpow function (mpz_powm).

> Any idea why that'd be? That's be with 2048 bit numbers.

mpz_powm transforms the numbers in such a way that repeated modulus 
computation will be faster. If only one pass is needed... the 
transformation is not worth doing.

On the other side

       mpz_powm (a, a, 2^2048, n);

should be faster than 2048 times

       mpz_mul(b,a,a);
       mpz_mod(a,b,n);

Ĝis,
m


More information about the gmp-discuss mailing list