Or, if you want to do it in a single line (which does the same as the  
more explicit code below)

sage: mod(520622, 998171) ^ 430085
897985

On Sep 25, 2008, at 9:43 AM, John Cremona wrote:

>
> sage: 520622^430085 % 998171
> 897985
>
>
> It is very much faster to do it more like this:
> sage: R=Integers(998171)
> sage: a=R(520622)
> sage: a^430085
> 897985
>
> The first way (I think) computes 520622^430085 as an integer and then
> reduces, while the second way constructs the ring of integers mod
> 998171, defines a as the residue of 520622 in that ring, and then
> exponentiates.
>
> John Cremona
>
> 2008/9/25 Mikemak27 <[EMAIL PROTECTED]>:
>>
>> I am brand new to this. I was wondering how to calculate mods  
>> while in
>> the sage notebook. I need to calculate 520622^430085 mod 998171. Does
>> anyone know how to type this into the command line. I keep getting a
>> syntax error. I have no idea how to do this because I am brand new to
>> sage. Thank you.
>>
>>>
>>
>
> >


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to