Prime Equation

3.7

22 votes
Problem

Recently Akash got this equation. Now being curious he wanted to know that for a given N , is it possible to find P1, P2, P3 and P4 for below equation under following conditions.

( P1-P2 ) + ( P3 - P4 ) = N
  1. P1, P2, P3, P4 are prime numbers
  2. P1 and P2 are consecutive Primes and P1 > P2
  3. P3 and P4 are consecutive Primes and P3 > P4
  4. It is possible that P1=P3 and P2=P4
  5. 3 ≤ P1,P2,P3,P4 ≤ 107

NOTE : Consecutive primes are the primes next to each other. i.e, 2 and 3 , 7 and 11 , 17 and 19 are considered as consecutive prime numbers.

Input :
First line contains T - No. of Test cases.
For each test case there is only one line containing N.

output :
Output "YES" if such P1,P2,P3,P4 are possible else print "NO" in each line

Constraints :
1≤ T ≤ 105
1≤ N ≤ 107
P1 , P2 ,P3 , P4 <= 10^7

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Test Case #1 : You can choose P1=5 P2=3 P3=13 P4=11

Editor Image

?