MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / inv_sieve

Function inv_sieve

code/mathematics/mod_inv_sieve.cpp:1–4  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1vi inv_sieve(int n, int p) {
2 vi inv(n,1);
3 rep(i,2,n) inv[i] = (p - (ll)(p/i) * inv[p%i] % p) % p;
4 return inv; }
5// vim: cc=60 ts=2 sts=2 sw=2:

Callers 1

testFunction · 0.85

Calls

no outgoing calls

Tested by 1

testFunction · 0.68