Re: question about result from mpz_ModPow

Marco Bodrato bodrato at anjara.org
Wed Aug 26 18:01:05 CEST 2026


Ciao,

Il giorno Domenica, Agosto 23, 2026 00:42 CEST, hermann at stamm-wilbrandt.de ha scritto:
> On 2026-08-20 18:21, Marco Bodrato wrote:
> > I use “Proth number” for a numbers $P$ of the form P=k*2^n+1 where
> > $k$ is odd and k<2^n.

> On your step
> - search a suitable base using mpz_kronecker_ui;
> 
> If it will not process potential bases increasingly, a test "k%3 != 0"
> likely speeds up that step.

I'm not sure it's worth to isolate the value k, so the test should be "P%3 == 2".

It may be worth to write a function that selects the suitable k, with a loop on primes only.
It could be shared with the function in mpz/stronglucas.c which starts with an almost equivalent search for a value "D" that is basically the same. The only difference is that it skips 3 and uses 15.

Ĝis,m



More information about the gmp-devel mailing list