Results 1 to 4 of 4

Math Help - Calculating large powers, large modulo.

  1. #1
    Newbie
    Joined
    Apr 2012
    From
    Ireland
    Posts
    2

    Calculating 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?!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Senior Member
    Joined
    Jan 2008
    From
    UK
    Posts
    484
    Thanks
    66

    Re: Calculating large powers, large modulo.

    How do you want to calculate this? I have a simple function that does the job.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Apr 2012
    From
    Ireland
    Posts
    2

    Re: Calculating large powers, large modulo.

    I'd like to calculated any way that's possible... Please share...
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Senior Member
    Joined
    Jan 2008
    From
    UK
    Posts
    484
    Thanks
    66

    Re: 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
    }
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Comparing large prime powers.
    Posted in the Number Theory Forum
    Replies: 5
    Last Post: November 9th 2010, 07:08 AM
  2. Finding derivative involving large powers.
    Posted in the Calculus Forum
    Replies: 7
    Last Post: January 15th 2010, 07:16 PM
  3. Why does this function act like this for large z?
    Posted in the Differential Geometry Forum
    Replies: 3
    Last Post: November 26th 2009, 05:24 PM
  4. Another question about large powers of matrices
    Posted in the Advanced Algebra Forum
    Replies: 6
    Last Post: August 19th 2009, 05:43 PM
  5. e^2x = (1+2x/n)^n for large n?
    Posted in the Advanced Statistics Forum
    Replies: 8
    Last Post: July 17th 2007, 11:33 AM

Search Tags


/mathhelpforum @mathhelpforum