library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub matumoto1234/library

:warning: math/factorize.hpp

Depends on

Required by

Code

#include "./base.hpp"

#include <vector>

namespace matumoto {
  vector<ll> factorize(ll n) {
    vector<ll> res;
    for (ll i = 2; i * i <= n; i++) {
      while (n % i == 0) {
        res.emplace_back(i);
        n /= i;
      }
    }
    if (n > 1)
      res.emplace_back(n);
    return res;
  }
} // namespace matumoto
#line 2 "math/base.hpp"

namespace matumoto {
  using namespace std;
  using ll = long long;
} // namespace matumoto
#line 2 "math/factorize.hpp"

#include <vector>

namespace matumoto {
  vector<ll> factorize(ll n) {
    vector<ll> res;
    for (ll i = 2; i * i <= n; i++) {
      while (n % i == 0) {
        res.emplace_back(i);
        n /= i;
      }
    }
    if (n > 1)
      res.emplace_back(n);
    return res;
  }
} // namespace matumoto
Back to top page