On Feb 5, 8:14 pm, mukesh tiwari wrote:
> I have to find out the last M digits of expression.One thing i can do
> is (A**N)%M but my A and N are too large (10^100) and M is less than
> 10^5. The other approach was repeated squaring and taking mod of
> expression. Is there any other way to do t
monkeys paw wrote:
mukesh
tiwari wrote:
Hello everyone. I am kind of new to python so pardon me if i sound
stupid.
I have to find out the last M digits of expression.One thing i can do
is (A**N)%M but my A and N are too large (10^100) and M is less than
10^5. The other approach was repeated
a nice exercise to do can be this problem :
http://www.codechef.com/MARCH09/problems/A4/ , it deals with both cases,
first and last k digits and can be performed within O(log n)
On Sun, Feb 7, 2010 at 3:58 AM, Shashwat Anand wrote:
> Yes, it can be done. Have a look at :
> http://en.wikipedia.org
Yes, it can be done. Have a look at :
http://en.wikipedia.org/wiki/Modular_exponentiation
The algorithm is also mentioned in CLRS.I tried writing my own
modular-exponentiation code following CLRS but observed that python pow()
function is much more efficient.
Have a look at this problem : https://w
mukesh tiwari wrote:
Hello everyone. I am kind of new to python so pardon me if i sound
stupid.
I have to find out the last M digits of expression.One thing i can do
is (A**N)%M but my A and N are too large (10^100) and M is less than
10^5. The other approach was repeated squaring and taking
On Feb 5, 2:18 pm, Mark Dickinson wrote:
> On Feb 5, 8:14 pm, mukesh tiwari wrote:
>
> > Hello everyone. I am kind of new to python so pardon me if i sound
> > stupid.
> > I have to find out the last M digits of expression.One thing i can do
> > is (A**N)%M but my A and N are too large (10^100)
On Fri, Feb 5, 2010 at 3:14 PM, mukesh tiwari
wrote:
> Hello everyone. I am kind of new to python so pardon me if i sound
> stupid.
> I have to find out the last M digits of expression.One thing i can do
> is (A**N)%M but my A and N are too large (10^100) and M is less than
> 10^5. The other appr
On Feb 5, 8:14 pm, mukesh tiwari wrote:
> Hello everyone. I am kind of new to python so pardon me if i sound
> stupid.
> I have to find out the last M digits of expression.One thing i can do
> is (A**N)%M but my A and N are too large (10^100) and M is less than
> 10^5. The other approach was r
Hello everyone. I am kind of new to python so pardon me if i sound
stupid.
I have to find out the last M digits of expression.One thing i can do
is (A**N)%M but my A and N are too large (10^100) and M is less than
10^5. The other approach was repeated squaring and taking mod of
expression. Is t