Re: gaussian integer modulus / Pollard's rho method on gaussian integers

Bill Allombert <[email protected]> Thu, 27 Nov 2025 11:05:46 +0100
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <aSgienkGV06hOdQo@seventeen>
On Thu, Nov 27, 2025 at 08:52:44AM +0100, [email protected] wrote:
> I looked at this again, and realized what is going on.
> The code does the same [w/z = w*conj(z)/norml2(z)] as
> 
> qr = w/z
> gi = round(real(qr)) + I*round(imag(qr)));
> r = w - gi*z
> 
> but completely keeping everything a t_INT during computation
> since (u-gismod(u,n)) is guaranteed to be a multiple of n.
> 
> I tried to use "\" for that reason, but GP errors with
> "_\_: forbidden division t_COMPLEX \ t_INT."
> 
> I know there is no Gaussian Integer type in GP.
> But could a meaningfully renamed "gimod()" function for "Gaussian integer
> mod" be made part of GP?

This requires to fix a convention for the Euclidean division for Gaussian integer,
and of course not all t_COMPLEX are Gaussian integers.

Note that GP has aleeady a function nfdiveuc to do that with a different interface.

Cheers,
Bill.