MCPcopy Create free account
hub / github.com/Compaile/ctrack / isPrime

Function isPrime

examples/multithreaded_prime_counter.cpp:10–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8std::atomic<int> primeCount(0);
9
10bool isPrime(int n) {
11 CTRACK;
12 if (n <= 1) return false;
13 for (int i = 2; i <= std::sqrt(n); ++i) {
14 if (n % i == 0) return false;
15 }
16 return true;
17}
18
19void countPrimesInRange(int start, int end) {
20 CTRACK;

Callers 1

countPrimesInRangeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected