📅  最后修改于: 2022-03-11 14:56:58.196000             🧑  作者: Mango
public List factorsOf(int n) {
ArrayList factors = new ArrayList<>();
for (int d = 2; n > 1; d++)
for (; n % d == 0; n /= d)
factors.add(d);
return factors;
}