Given an integer N, the task is to find the count of all the primes below N which can be expressed as the sum of two primes.
Input: N = 6
5 is the only such prime below 6.
2 + 3 = 5.
Input: N = 11
Approach: Create an array prime where prime[i] will store whether i is prime or not using Sieve of Eratosthenes. Now for every prime from the range [1, N – 1], check whether it can be expressed as the sum of two primes using the approach discussed here.
Below is the implementation of the above approach:
- Count primes that can be expressed as sum of two consecutive primes and 1
- Check if an integer can be expressed as a sum of two semi-primes
- Length of largest sub-array having primes strictly greater than non-primes
- Count Primes in Ranges
- Count number of primes in an array
- Count numbers < = N whose difference with the count of primes upto them is > = K
- Maximum count of common divisors of A and B such that all are co-primes to one another
- Count numbers which can be represented as sum of same parity primes
- Count the number of primes in the prefix sum array of the given array
- Circular primes less than n
- Palindromic Primes
- Print all Proth primes up to N
- Product of all primes in the range from L to R
- Alternate Primes till N
- Product of Primes of all Subsets
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.