MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / b_expo_mod

Function b_expo_mod

other/binary_exponentiation.py:26–35  ·  view source on GitHub ↗
(a, b, c)

Source from the content-addressed store, hash-verified

24
25
26def b_expo_mod(a, b, c):
27 res = 1
28 while b > 0:
29 if b&1:
30 res = ((res%c) * (a%c)) % c
31
32 a *= a
33 b >>= 1
34
35 return res
36
37"""
38* Wondering how this method works !

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected