← All problemsSign in

Sum of Primes

CodeChefRating 3203Open on judge ↗

$f$ is a function such that $f(x)$ equals the number of ways in which $x$ can be expressed as sum of two prime numbers. For example $f(10) = 2$, as 10 can be expressed as sum of two primes in two ways: $ 3 + 7 = 5 + 5 = 10$. More formally, $f(x)$ is the number of pairs $(a, b)$ such that $0\le a \le b < x$ and $a$ and $b$ are prime and $a + b = x$. Given an integer $N$, find the number of pairs

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start