I'm able to get around the standard: x^a mod n.

But only when it's regarding relatively small variables.

But what method should I use to solve problems like: 33809^26767 mod 46927?

Should I use Euler's Totient somehow? If so, how?!

Printable View

- April 25th 2012, 04:49 AMAloneInTheWorldCalculating large powers, large modulo.
I'm able to get around the standard: x^a mod n.

But only when it's regarding relatively small variables.

But what method should I use to solve problems like: 33809^26767 mod 46927?

Should I use Euler's Totient somehow? If so, how?! - April 25th 2012, 05:07 AMa tutorRe: Calculating large powers, large modulo.
How do you want to calculate this? I have a simple function that does the job.

- April 25th 2012, 05:18 AMAloneInTheWorldRe: Calculating large powers, large modulo.
I'd like to calculated any way that's possible... Please share...

- April 25th 2012, 05:49 AMa tutorRe: Calculating large powers, large modulo.
It's crude but it works.

Code:`modpow(a,p,m)`

{

k=1

v=a

while (2*k<p)

{

v=v^2 mod m

k*=2

}

while (k<p)

{

v=v*a mod m

k++

}

return v

}