For some reason my val
variable isn't increasing within the while-loop. Any reason as to why it's not doing so? 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);
}
}
}