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

Function test

code/mathematics/mod_inv_sieve.test.cpp:2–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "../code/mathematics/is_prime.cpp"
2void test() {
3 rep(it,0,300) {
4 int p = rng() % 2000000000;
5 while (!is_prime(p)) p++;
6 int n = min(100000, p);
7 vi inv = inv_sieve(n, p);
8 rep(i,1,n) {
9 // cout << n << " " << p << " " << i << " " << inv[i] << endl;
10 assert((ll)i * inv[i] % p == 1);
11 }
12 }
13}
14// vim: cc=60 ts=2 sts=2 sw=2:

Callers

nothing calls this directly

Calls 2

is_primeFunction · 0.85
inv_sieveFunction · 0.85

Tested by

no test coverage detected