- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Super Prime in c programming

A super-prime number is A number that occupies prime number position in the sequence of all prime numbers. also known as high order primes, These numbers occupy the position in the sequence of prime number which is equal to Prime number. some super prime numbers are 3,5,11,1 7…

For Example let us Find all super prime numbers less than 13 -

**Input **

13

**Output**

3, 5, 11.

**Explanation** − to find the super prime number less than 13 we will find all prime numbers that are less than 13. So, show all prime numbers less than 13 are 2,3,5,7,11,13. Now, 2 is a prime number, so we will consider the prime number at position to as a super prime number. this means three is a prime number. Similarly, 5 at position 3 , and 11 at position 5 are super prime numbers.

to find all super-prime numbers that are less than a given prime number the will first find all prime numbers that are are less than that number and Store then in an array. from this array will print only those numbers whose position is equal to any of the prime numbers. For example, the prime number at 2nd 3rd 5th 7th 11th 13th…. are considered.

## Example

#include<iostream> using namespace std; bool SieveOfEratosthenes(int n, bool isPrime[]) { isPrime[0] = isPrime[1] = false; for (int i=2; i<=n; i++) isPrime[i] = true; for (int p=2; p*p<=n; p++) { if (isPrime[p] == true) { for (int i=p*2; i<=n; i += p) isPrime[i] = false; } } } void superPrimes(int n) { bool isPrime[n+1]; SieveOfEratosthenes(n, isPrime); int primes[n+1], j = 0; for (int p=2; p<=n; p++) if (isPrime[p]) primes[j++] = p; for (int k=0; k<j; k++) if (isPrime[k+1]) cout << primes[k] << " "; } int main() { int n = 343; cout << "Super-Primes less than "<< n << " are :"<<endl; superPrimes(n); return 0; }

## Output

Super-Primes less than 343 are : 3 5 11 17 31 41 59 67 83 109 127 157 179 191 211 241 277 283 331

- Related Questions & Answers
- Super constructor in Dart Programming
- Super keyword in Dart Programming
- Super and Self Keywords in Rust Programming
- Super Pow in C++
- Super Palindromes in C++
- Super Ugly Number in C++
- Super Washing Machines in C++
- Super Egg Drop in C++
- Equivalent of Java Super Keyword in C#
- Balanced Prime in C++
- Prime Triplet in C++
- Prime String in C++
- Prime Palindrome in C++
- Pierpont Prime in C++
- Super Key in RDBMS