Skip to content

Commit 0ad77ae

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

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ 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) && isPrime(n - 1)) {
46+
if (isPrime(i) && isPrime(n - i)) {
4747
System.out.println(format("%d + %d = %d", i, n - i, n));
4848
flag = 1;
4949
}

0 commit comments

Comments
 (0)