Skip to content

Instantly share code, notes, and snippets.

@sbuggay
Created August 12, 2019 22:22
Show Gist options
  • Save sbuggay/cb40dc896e3cdaad707b7040ba9d5c03 to your computer and use it in GitHub Desktop.
Save sbuggay/cb40dc896e3cdaad707b7040ba9d5c03 to your computer and use it in GitHub Desktop.
vector<int> factorize(int num) {
vector<int> output;
int i = 2;
while (num > 1) {
if (num % i == 0) {
output.push_back(i);
num = num / i;
}
else {
i++;
}
}
return output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment