📅  最后修改于: 2022-03-11 14:52:27.838000             🧑  作者: 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;
}