Bill Allombert on Sun, 18 Oct 2009 19:01:08 +0200


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

Re: Calculating powmod...


On Sun, Oct 18, 2009 at 11:20:51AM -0500, David Cleaver wrote:
> Hello,
>
> I'm interested in calculating "powmod"'s such as:
> Mod(2^9182347891540, 9182347891541)
> However, when I ran the function, it gave an error:
>  ***   length (lg) overflow

Of course because PARI cannot compute 2^9182347891540.
You should compute with the class of 2 in in Z/9182347891541Z, i.e.
Mod(2, 9182347891541).  In that case you get:

? Mod(2, 9182347891541)^9182347891540
%1 = Mod(7569093976632, 9182347891541)

Cheers,
Bill.