MCPcopy Create free account
hub / github.com/cp-algorithms/cp-algorithms / power

Function power

test/test_factorization.cpp:8–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6using namespace std;
7
8long long power(long long b, long long e, long long mod) {
9 long long res = 1;
10 while (e) {
11 if (e & 1)
12 res = res * b % mod;
13 b = b * b % mod;
14 e >>= 1;
15 }
16 return res;
17}
18
19long long gcd(long long a, long long b) {
20 if (a == 0)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected