import java.math.BigInteger; public class prob216 { public static void main(String args[]) { BigInteger n,mult,i,max,subt; i = new BigInteger("2"); mult = new BigInteger("2"); //max = new BigInteger("10000"); max = new BigInteger("50000000"); int x = 0; while (i.compareTo(max) <= 0) { n = i.pow(2).multiply(mult).subtract(BigInteger.ONE); if (n.isProbablePrime(3)) { x++; if (x % 10000 == 0) System.out.println("Total: (" + i + ") " + x); } i = i.add(BigInteger.ONE); } System.out.println("Total: " + x); } }