Goldbach's Other Conjecture

Run Settings
LanguageJava
Language Version
Run Command
class Main { public static void main(String[] args) { int n = 9; int x = 2; int y = 1; boolean foundWrong = false; boolean foundTrue = false; while(foundWrong == false) { //increasing test number foundTrue = false; while(x <= n && foundTrue == false){ //increasing subtracted number if(isPrime(x)) { y = n - x; if(Math.sqrt(y / 2) % 1 == 0 && y != 0) foundTrue = true; //System.out.println(n + " = " + x + " + " + y + " is twice a square: " + foundTrue); } if(x == 2) x += 1; else x += 2; } if(foundTrue == false) { foundWrong = true; System.out.println(n); } x = 2; n += 2; while(isPrime(n) == true) { n += 2; } } } public static boolean isPrime(int x) { int sqrt = (int) Math.sqrt(x); if(x <= 1) { return false; } else if(x < 4) { return true; } else{ if(x % 2 == 0) { return false; } for(int i = 3; i <= sqrt; i += 2) { if(x % i == 0) { return false; } } return true; } } }
Editor Settings
Theme
Key bindings
Full width
Lines