Functions
Function-34
Function-35
Function-36
~/algor $ cat problems/funksiya-goldbax
Goldbach's conjecture
Medium
1000 ms
128 MB
61%
Write a function Goldbach(n): an even positive integer $n$ can be written as a sum of two primes $n = p + q$; the function returns the smallest such prime $p$.
Example 1: Goldbach(28) → 5 — $28 = 5 + 23$; $28 = 11 + 17$ also works, but $5$ is smaller.
Example 2: Goldbach(4) → 2 — $4 = 2 + 2$.
Write only the function body.
Input
One line with a positive integer $n$ — the argument of the function.
Output
The value returned by the function: an integer.
Note
$4 \le n \le 10^{7}$
$n$ is even
Examples
Input #1
28
Output #1
5
Input #2
4
Output #2
2