#C13539. Sum of Two Primes
Sum of Two Primes
Sum of Two Primes
Given an integer n, determine whether it can be expressed as the sum of two prime numbers. A prime number is a natural number greater than 1 that has no divisors other than 1 and itself. Specifically, you are to check if there exists two primes p and q such that
\( n = p + q \).
For example:
- For
n = 10
, since 10 = 3 + 7 (both prime), the answer isTrue
. - For
n = 11
, no such pair of prime numbers exists, so the answer isFalse
. - For
n = 4
, the only possibility is 2 + 2, so the answer isTrue
.
Your task is to implement an efficient algorithm for prime checking so that your solution works well even for large values of n.
inputFormat
The input consists of a single integer n
provided via standard input (stdin).
outputFormat
Output a single word: True
if n
can be represented as the sum of two prime numbers, otherwise output False
. The output should be printed to standard output (stdout).
10
True