summaryrefslogtreecommitdiff
path: root/sieve_utils.cc
blob: 51bdcf1676dd069e8b6e6b95e5d5e5d3543e6c2f (plain)
1
2
3
4
5
6
7
8
9
10
#include "sieve.hh"
#include <cmath>

[[nodiscard]] bool isPrime(std::size_t x) {
  for (size_t i = 2; i <= sqrt(x); ++i)
    if (x % i == 0) {
      return false;
    }
  return true;
}