Jeroen Demeyer on Fri, 25 Nov 2005 14:01:14 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: modular exponentiation

Henk Karssenberg wrote:
Dear M.,
In PARI I try to calculate k = Mod(6682632708227277^28345232917, 72057594037927889) but this gives an overflow. Is there any option to calculate Mod(a^m,n) or a^m % n with huge numbers ?

Thank you & kind regards.


You should do k = Mod(a,n)^m.
This works because Mod(a,n) creates an object in Z/nZ.