Skip to content

Commit 93b4e5e

Browse files
committed
Added Goldbach's Conjecture algorithm.
1 parent bf54316 commit 93b4e5e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/main/java/com/thealgorithms/maths/GoldbachConjecture.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,9 @@ public static void main(String[] args) {
4343

4444
if (n % 2 == 0 && n > 2) {
4545
for (int i = 0; i <= n / 2 && flag == 0; i++) {
46-
if (isPrime(i)) {
47-
if (isPrime(n - i)) {
46+
if (isPrime(i) && isPrime(n - 1)) {
4847
System.out.println(format("%d + %d = %d", i, n - i, n));
4948
flag = 1;
50-
}
5149
}
5250
}
5351
} else {

0 commit comments

Comments
 (0)