Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/subbarayudu-j/TheAlgorithms-Python
/ b_expo
Function
b_expo
other/binary_exponentiation.py:14–23 ·
view source on GitHub ↗
(a, b)
Source
from the content-addressed store, hash-verified
12
13
14
def
b_expo(a, b):
15
res = 1
16
while
b > 0:
17
if
b&1:
18
res *= a
19
20
a *= a
21
b >>= 1
22
23
return
res
24
25
26
def
b_expo_mod(a, b, c):
Callers
nothing calls this directly
Calls
no outgoing calls
Tested by
no test coverage detected