Re: Finding the remainder from very large division



rob@xxxxxxxxxxxxxx (Rob Johnson) writes:
In article <fikhk6$4qj$1@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
Dave Seaman <dseaman@xxxxxxxxxxxx> wrote:
On Wed, 28 Nov 2007 11:44:14 -0800 (PST), marksmith@xxxxxxxxxxxxxxxxx wrote:
I am trying to use Fermats Theorem to find: 3^201 mod 11
....
The Mathematica command for this is:

In[1]:= PowerMod[3,201,11]

Out[1]= 3

Or simply use bc from the Terminal and enter

(3^201)%11

Bletch. Large intermediate value. dc's a much better fit:

3 201 11|p

Test bc's ``3^20000001%11'' against dc's
``3 20000001 11|p'' for a clearer example of why you don't
want to create unnecessarily large intermediates.

Phil
--
Dear aunt, let's set so double the killer delete select all.
-- Microsoft voice recognition live demonstration
.


Quantcast