Solved

Fermats n Eulers theorem

Posted on 2004-09-28
10
661 Views
Last Modified: 2012-05-07
I know what Fermat's and Eulers theorem are.

this is a question that i have been given..

Use Fermat or Euler's theorem (whichever is applicable) to compute

a) 3 ^ 201 mod 11
b) 3^{2161} mod 1147..

how am i supposed to use Fermat's or Euler's thoerem for this?

Fermat's little theorem said that a^p-1 = 1 mod p.

any ideas?

thanks,
0
Comment
Question by:younoeme
  • 7
  • 3
10 Comments
 
LVL 27

Expert Comment

by:d-glitch
ID: 12173527

 3^201 mod 11   =   [(3^10)^20] * (3^1)  mod 11

                         =   [ 1^20 mod 11 ] * [3 mod 11]

                         =   3 mod 11

               
0
 
LVL 27

Expert Comment

by:d-glitch
ID: 12173789
3^2161 mod 1147   =   3^1146  * 3^1015  mod 1147

                             =      1         * 3^512 * 3^256 * 3^128 * 3^64 * 3^32 * 3^16 * 3^4 * 3^2 * 3^1    mod 1147

                             =   [ more math to do                                 ]   *    958   *  826   *  81 *    9   *    3


You can use fermat's theorom to reduce the exponent to less than p-1

Whatever is left you have to the old fashioned way. But you can break it up into exponents that are powers of two, you can bootstrap your way up and reduce the math.

I did the first few.    The next step is:         3^64 mod 1147  =  3^32 ^ 3^32 mod 1147  =  958 * 958 mod 1147
0
 
LVL 27

Expert Comment

by:d-glitch
ID: 12173875
I mad a mistake in my last post:

3^1   mod 1147    =     3
3^2    mod 1147   =     9
3^4    mod 1147   =    81
3^8    mod 1147   =  826  ==>  You don't use this term in the answer, but you still have to calculate it to get the next term in the series.
3^16   mod 1147  =  958
3^32   mod 1147  =  958^2 mod 1147
3^64   mod 1147
3^128  mod 1147
3^256  mod 1147
3^512  mod 1147


0
 
LVL 27

Expert Comment

by:d-glitch
ID: 12174258
3^{2161} mod 1147..

1147 = 31 * 37   It isn't prime so you can't use Fermat's Little Theorem.
0
 
LVL 27

Expert Comment

by:d-glitch
ID: 12174357
You need to use Euler's Totient Function:        http://mathworld.wolfram.com/EulersTotientTheorem.html
                                                                  http://mathworld.wolfram.com/TotientFunction.html


 phi(1147) = 1147 * (30/31) * (36/37)  = 1080   ==>  Euler's Totient Function

3^1080 mod 1147 = 1                                      ==> Euler's Totient Theorem


3^2161 mod 1147   =   (3^1080) * (3^1080) * 3^1  mod 1147
                             =        1        *       1       *  3     mod 1147
                             =    3
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 9

Expert Comment

by:rjkimble
ID: 12176516
Verification from Maxima:

(C1) mod(3^201,11);
(D1)                                3
(C2) mod(3^2161,1147);
(D2)                                3
0
 
LVL 27

Accepted Solution

by:
d-glitch earned 100 total points
ID: 12179619
In summary:

   a^n  mod b ==> mod( a^n, b)


If the base b is prime, you can use Fermat's Little Theorem to reduce the exponent:
 
                                        mod( a^n, b) = 1 reduces to mod( a^m, b) where m = mod(n, b-1)


If the base b is composite, you can use Euler's Totient Theorem to reduce the exponent:
 
                                        mod( a^n, b) = 1 reduces to mod( a^m, b) where m = mod(n, phi(b))

If m is small you may be able to find the answer by inspection.

If m is large, you can use the binary decomposition, as I suggested in my otherwise irrelevent post.
0
 
LVL 9

Expert Comment

by:rjkimble
ID: 12186748
Very nicely stated.
0
 
LVL 27

Expert Comment

by:d-glitch
ID: 12191235
Thanks rjk.

It would have been even nicer if I had left out the =1's

                                   mod( a^n, b)  reduces to ...

Another senseless cut and paste tragedy.
0
 
LVL 9

Expert Comment

by:rjkimble
ID: 12191310
Good point. My bleary eyes glossed over that. Still, the way you laid things out is quite nice.

.... Bob
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tricky equity split scenario after house is sold 4 73
Data array of weights 2 60
Least Squares Curve Fitting 4 61
Normalised finishing position 2 44
How to Win a Jar of Candy Corn: A Scientific Approach! I love mathematics. If you love mathematics also, you may enjoy this tip on how to use math to win your own jar of candy corn and to impress your friends. As I said, I love math, but I gu…
Article by: Nicole
This is a research brief on the potential colonization of humans on Mars.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now