#K40157. Sum of Two Primes
Sum of Two Primes
Sum of Two Primes
You are given a non-negative integer \(n\). Your task is to determine whether \(n\) can be expressed as the sum of two prime numbers.
A prime number is defined as a natural number greater than 1 that has no positive divisors other than 1 and itself. More formally, a number \(p > 1\) is prime if and only if the only divisors of \(p\) are 1 and \(p\).
For example:
- \(34 = 3 + 31\) (both 3 and 31 are prime) therefore output is
YES
. - \(11\) cannot be expressed as the sum of two primes, so the answer is
NO
.
You need to read the input from stdin
and output the result to stdout
.
inputFormat
The input consists of a single line that contains a non-negative integer \(n\) (\(0 \le n \le 10^6\)). This integer is provided via standard input.
outputFormat
The output should be a single line: YES
if \(n\) can be expressed as the sum of two prime numbers, and NO
otherwise. The output should be printed to standard output.
34
YES