7 #ifndef WONTON_PRIME_FACTOR_H_ 8 #define WONTON_PRIME_FACTOR_H_ 19 std::vector<int> prime_factors(
unsigned int const N) {
20 constexpr
int nprimes = 10;
21 int primes[nprimes] = {2,3,5,7,11,13,17,19,23,29};
22 std::vector<int> factors;
35 if (num%primes[i] == 0) {
36 factors.push_back(primes[i]);
40 if (num == 1 || i == nprimes)
Factorize a number N into D equal (or nearly equal) factors.
Definition: adaptive_refinement_mesh.h:31