Home > College Algebra calculators > Fast modular exponentiation example

6. Fast modular exponentiation example ( Enter your problem )
  1. Example-1 : `3^302 mod 5`
  2. Example-2 : `19^24 mod 21`
  3. Example-3 : `7^106 mod 143`
  4. Example-4 : `27^400 mod 619`
Other related methods
  1. Chinese Remainder Theorem
  2. Extended Euclidean Algorithm
  3. Euclid's Algorithm
  4. Modular multiplicative inverse
  5. Modulo
  6. Fast modular exponentiation

1. Example-1 : `3^302 mod 5`
(Previous example)
3. Example-3 : `7^106 mod 143`
(Next example)

2. Example-2 : `19^24 mod 21`





19^24 mod 21

Solution:
Fast Modular Exponentiation
`19^24" mod "21`

Comparing with `A^B" mod "C`

We get `A=19,B=24,C=21`

Step 1: Divide B into powers of 2 by writing it in binary

`24=11000` in binary

`24=2^3+2^4`

`24=8+16`

`19^24" mod "21=19^((8+16))" mod "21`

`19^24" mod "21=(19^8*19^16)" mod "21`


Step 2: Calculate mod C of the powers of two <= B

`19^1" mod "21=19" mod "21=19`

`19^2" mod "21=(19^1*19^1)" mod "21=(19^1" mod "21*19^1" mod "21)" mod "21=(19*19)" mod "21=361" mod "21=4`

`19^4" mod "21=(19^2*19^2)" mod "21=(19^2" mod "21*19^2" mod "21)" mod "21=(4*4)" mod "21=16" mod "21=16`

`19^8" mod "21=(19^4*19^4)" mod "21=(19^4" mod "21*19^4" mod "21)" mod "21=(16*16)" mod "21=256" mod "21=4`

`19^16" mod "21=(19^8*19^8)" mod "21=(19^8" mod "21*19^8" mod "21)" mod "21=(4*4)" mod "21=16" mod "21=16`


Step 3: Use modular multiplication properties to combine the calculated mod C values

`19^24" mod "21`

`=(19^8*19^16)" mod "21`

`=(19^8" mod "21*19^16" mod "21)" mod "21`

`=(4*16)" mod "21`

`=64" mod "21`

`=1`

`:.19^24" mod "21=1`


This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then Submit Here



1. Example-1 : `3^302 mod 5`
(Previous example)
3. Example-3 : `7^106 mod 143`
(Next example)





Share this solution or page with your friends.


 
Copyright © 2024. All rights reserved. Terms, Privacy
 
 

.