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

Function is_prime

code/mathematics/is_prime.cpp:1–8  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1bool is_prime(int n) {
2 if (n < 2) return false;
3 if (n < 4) return true;
4 if (n % 2 == 0 || n % 3 == 0) return false;
5 if (n < 25) return true;
6 for (int i = 5; i*i <= n; i += 6)
7 if (n % i == 0 || n % (i + 2) == 0) return false;
8 return true; }
9// vim: cc=60 ts=2 sts=2 sw=2:

Callers 4

testFunction · 0.85
testFunction · 0.85
testFunction · 0.85
testFunction · 0.85

Calls

no outgoing calls

Tested by 4

testFunction · 0.68
testFunction · 0.68
testFunction · 0.68
testFunction · 0.68