📌  相关文章
📜  数的质因数 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:27.838000             🧑  作者: Mango

代码示例2
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;
}