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

Function inverse

test/test_fft.cpp:22–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21namespace modular {
22long long inverse(long long x, int mod) {
23 long long res = 1;
24 int e = mod - 2;
25 while (e) {
26 if (e & 1)
27 res = res * x % mod;
28 x = x * x % mod;
29 e >>= 1;
30 }
31 return res;
32}
33
34#include "fft_implementation_modular_arithmetic.h"
35

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected