younoeme
asked on
Fermats n Eulers theorem
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,
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,
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
= 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
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
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
3^{2161} mod 1147..
1147 = 31 * 37 It isn't prime so you can't use Fermat's Little Theorem.
1147 = 31 * 37 It isn't prime so you can't use Fermat's Little Theorem.
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
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
Verification from Maxima:
(C1) mod(3^201,11);
(D1) 3
(C2) mod(3^2161,1147);
(D2) 3
(C1) mod(3^201,11);
(D1) 3
(C2) mod(3^2161,1147);
(D2) 3
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Very nicely stated.
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.
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.
Good point. My bleary eyes glossed over that. Still, the way you laid things out is quite nice.
.... Bob
.... Bob
3^201 mod 11 = [(3^10)^20] * (3^1) mod 11
= [ 1^20 mod 11 ] * [3 mod 11]
= 3 mod 11