Computer Science, asked by sanketmhaske1043, 11 months ago

Create and delete stacks of aws resources which are defined in templates

Answers

Answered by Anonymous
4

Answer:

Approach: An efficient approach is to find all the primes numbers up to N using Sieve of Eratosthenes and place all the prime numbers in a vector. Now, run a simple loop and add two consecutive primes and 1 then check if this sum is also a prime. If it is then increment the count.

Below is the implementation of the above approach:

Explanation:

Input: N = 27

Output: 2

13 = 5 + 7 + 1 and 19 = 7 + 11 + 1 are the required prime numbers.

Similar questions