Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/SuprDewd/CompetitiveProgramming
/ mod_pow
Function
mod_pow
code/mathematics/mod_pow.cpp:2–7 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
1
template <class T>
2
T mod_pow(T b, T e, T m) {
3
T res = T(1);
4
while (e) {
5
if (e & T(1)) res = smod(res * b, m);
6
b = smod(b * b, m), e >>= T(1); }
7
return res; }
8
// vim: cc=60 ts=2 sts=2 sw=2:
Callers
4
test
Function · 0.85
leg
Function · 0.85
tonelli_shanks
Function · 0.85
is_probable_prime
Function · 0.85
Calls
1
smod
Function · 0.85
Tested by
1
test
Function · 0.68