10871 - Primed Subsequence


Difficulty : medium

Solution Description :

Prime number problem

At first pre-generate prime number up to 1000000 using sieve.
Find the all possible length subsequence sum (length start from 2 to n).
If any sum is prime, then print the subsequence length and the subsequence.
Otherwise, print anti-primed.

For prime check if any sum is greater than 1000000 then check it manually.