Given an integer N. The task is to find the sum of the first N prime numbers which don’t contain any odd primes as their digit.
Some of such prime numbers are 2, 11, 19, 29, 41 ……
Input : N = 2
Output : 13
2 + 11 = 13
Input : N = 7
Output : 252
- We first use a Sieve of Eratosthenes to store all prime numbers.
- Next check for each prime number if any odd prime digit is present or not.
- If no such digit is present then we will include this prime to our required answer
- Continue above step until we get N such prime numbers
Below is the implementation of the above approach :
- Print prime numbers with prime sum of digits in an array
- Numbers with sum of digits equal to the sum of digits of its all prime factor
- Sum of all the prime numbers with the count of digits ≤ D
- Absolute difference between the Product of Non-Prime numbers and Prime numbers of an Array
- Find all the prime numbers of given number of digits
- Print the nearest prime number formed by adding prime numbers to N
- Count Numbers in Range with difference between Sum of digits at even and odd positions as Prime
- Absolute difference between the XOR of Non-Prime numbers and Prime numbers of an Array
- Absolute Difference between the Sum of Non-Prime numbers and Prime numbers of an Array
- Check if a prime number can be expressed as sum of two Prime Numbers
- Print all numbers whose set of prime factors is a subset of the set of the prime factors of X
- Prime numbers after prime P with sum S
- Print numbers such that no two consecutive numbers are co-prime and every three consecutive numbers are co-prime
- Recursive sum of digits of a number is prime or not
- Largest number with prime digits
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.