#C13944. Prime Sum Pair
Prime Sum Pair
Prime Sum Pair
You are given an integer array. Your task is to determine whether there exist two distinct indices i and j (with i < j) such that the sum of the two corresponding elements is a prime number.
More formally, given an array a[0...n-1]
, you need to check if there exist indices i and j satisfying:
\(0 \leq i < j \leq n-1\)
such that the number \(S = a[i] + a[j]\) is prime. A number \(p\) is prime if \(p > 1\) and it has no divisors other than 1 and itself.
If at least one such pair exists, print True
; otherwise, print False
.
inputFormat
The first line of input contains an integer n
, representing the number of elements in the array.
The second line contains n
space-separated integers denoting the elements of the array.
If n
is 0, the array is empty.
outputFormat
Print True
if there exists at least one pair \( (i, j) \) with i < j
such that the sum of a[i] + a[j]
is a prime number. Otherwise, print False
.
The output should be printed in a single line.
## sample4
4 6 8 10
False
</p>