[GAP Forum] GAP
Bill Allombert
Bill.Allombert at math.u-bordeaux.fr
Thu Apr 16 19:24:22 BST 2015
On Thu, Apr 16, 2015 at 05:35:20PM +0100, Sandeep Murthy wrote:
>
> Once you’ve defined the variables a and p you can just do
>
> gap> a^p mod p = a mod p;
>
> and
>
> gap> a^(p-1) mod p = 1;
I would suggest instead to do something like
ZmodnZObj(a,p)^(p-1);
instead to avoid computing a^(p-1) as a large integer.
gap> ZmodnZObj(2,4294967297)^4294967296;
ZmodnZObj( 1, 4294967297 )
gap> time;
0
gap> 2^4294967296 mod 4294967297;
1
gap> time;
2965
Cheers,
Bill.
More information about the Forum
mailing list