Quantcast

Modulus Using Binary Exponentiation

Last modified by
on
Jul 11, 2023, 5:27:51 PM
Created by
on
Jul 11, 2023, 4:14:47 PM
`n = a^(x)modm`
`(a) "Base"`
`(x) "Exponent"`
`(m) "Modulus"`
Tags
UUID
0e4aa1bf-2006-11ee-b65f-bc764e203090

The Modulus Using Binary Exponentiation equation is an efficient technique for calculating the result of raising a base to a large exponent and taking the modulus of the result.

INSTRUCTIONS: Enter the following

  • (a) Base
  • (x) Exponent
  • (m) Modulus

Result (n): The result is returned as the result of the large integer mod m

Example

n = 42313 mod 19

  • a = 42
  • x = 313
  • m = 19

313 = (100111001)2 >>> 28, 25, 24, 23, 20 = 256, 32, 16, 8, 1

Index 8 7 6 5 4 3 2 1 0
Binary Number 1 0 0 1 1 1 0 0 1

4267 mod 19 = (42256 x 4232 x 4216, 428, 421) mod 19 = [(42256 mod 19)(4232 mod 19)(4216 mod 19)(428 mod 19)(421 mod 19)] mod 19 = (9 x 17 x 6 x 5 x 4) mod 19 = 18360 mod 19

= 6

 


  • Comments
  • Attachments
  • Stats
No comments
This site uses cookies to give you the best, most relevant experience. By continuing to browse the site you are agreeing to our use of cookies.