#K67127. Three Prime Sum Challenge
Three Prime Sum Challenge
Three Prime Sum Challenge
You are given a positive integer n. Your task is to determine whether n can be expressed as the sum of three distinct prime numbers. In mathematical terms, you need to check if there exist three distinct prime numbers p1, p2, and p3 such that:
\(p_{1} + p_{2} + p_{3} = n\)
If such primes exist, output YES
; otherwise, output NO
.
Note: The smallest sum of three primes (2, 3, and 5) is 10, so any n < 6 automatically returns NO
.
inputFormat
The input consists of a single integer n provided via standard input (stdin).
outputFormat
Output a single line with either YES
or NO
via standard output (stdout) depending on whether n can be expressed as the sum of three distinct prime numbers.
23
YES