<分区>
出于某种原因,我的 val
变量在 while 循环中没有增加。有什么理由不这样做吗? val.add(BigInteger.ONE);
import java.math.*;
public static void main(String[] args) {
/* Variables */
BigInteger PQ = new BigInteger("17");
BigInteger E = new BigInteger("7");
BigInteger val = new BigInteger("2");
/* Find the PRIME factors of PQ */
while (PQ.compareTo(BigInteger.ONE) == 1) { // while the first value is greater
if (PQ.mod(val).equals(BigInteger.ZERO)) {
System.out.print(val + " ");
} else {
val.add(BigInteger.ONE);
}
}
}