> Am 16.04.2015 um 20:24 schrieb Bill Allombert > <bill.allomb...@math.u-bordeaux.fr>: > >> 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
Or use PowerMod resp. PowerModInt. > > Cheers, > Bill. > > _______________________________________________ > Forum mailing list > Forum@mail.gap-system.org > http://mail.gap-system.org/mailman/listinfo/forum _______________________________________________ Forum mailing list Forum@mail.gap-system.org http://mail.gap-system.org/mailman/listinfo/forum