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.
- Use an outer loop (
i) starting from 2 up tonum / 2. - Check if
iis a prime number. - If
iis prime, calculatej = num - i. - Check if
jis also a prime number. - If both are prime, print the pair: "num = i + j".
- Break after finding the first valid pair.
01EXAMPLE 1
Input
num = 10Output
10 = 3 + 7Explanation: 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
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
num10
Expected Output
10 = 3 + 7
Click RUN to test your solution