The Goldbach Triple

HardAcc. 76.4%
+45 XP 25

The Odd Balance

Goldbach's Weak Conjecture states that every odd integer greater than 5 is the sum of three primes. Example: $7 = 2 + 2 + 3$. $9 = 3 + 3 + 3$.

The Assignment

Your function receives an odd parameter num.

  1. Use triple-nested loops (i, j, k) to search for three prime numbers.
  2. Ensure i + j + k === num.
  3. To avoid duplicates, find the first set where i <= j <= k.
  4. Print the result: "num = i + j + k" and break.

01EXAMPLE 1

Inputnum = 7
Output7 = 2 + 2 + 3

Explanation: All factors are prime.

Constraints

  • Triple-nested search loop.
  • Correct primality tests.
MathLoops
JavaScript
Loading...
2 Hidden

Input Arguments

num7

Expected Output

7 = 2 + 2 + 3

Click RUN to test your solution