The Goldbach Conjecture

MediumAcc. 82.4%
+35 XP 15

The Prime Symmetry

Goldbach's Strong Conjecture states that every even integer greater than 2 is the sum of two primes. Example: $10 = 3 + 7$ or $5 + 5$.

The Assignment

Your function receives an even parameter num.

  1. Use an outer loop (i) starting from 2 up to num / 2.
  2. Check if i is a prime number.
  3. If i is prime, calculate j = num - i.
  4. Check if j is also a prime number.
  5. If both are prime, print the pair: "num = i + j".
  6. Break after finding the first valid pair.

01EXAMPLE 1

Inputnum = 10
Output10 = 3 + 7

Explanation: 3 and 7 are both prime.

Constraints

  • Use nested loops (one for the search, one for the primality test).
  • The output format must be exact.
MathLoopsLogic
JavaScript
Loading...
3 Hidden

Input Arguments

num10

Expected Output

10 = 3 + 7

Click RUN to test your solution