28 std::vector<std::optional<std::vector<uint>>>
mCache;
31 mCache.emplace_back(std::vector<uint>({}));
32 mCache.emplace_back(std::vector<uint>({1}));
36 while (mCache.size() <= n) {
37 mCache.emplace_back();
43 mCache[n] = std::vector<uint>();
45 for (std::size_t i = 0; ;) {
46 if (cur % mPrimes[i] == 0) {
47 mCache[n]->push_back(mPrimes[i]);
carl is the main namespace for the library.
This class provides a cached factorization for numbers.
std::vector< std::optional< std::vector< uint > > > mCache
PrimeFactory< uint > mPrimes
const std::vector< uint > & operator()(uint n)
Returns the factorization of n.