Given an integer N. The task is to find the Nth prime number.
Input : 5
Output : 11
Input : 16
Output : 53
Input : 1049
Output : 8377
- Find the prime numbers upto MAX_SIZE using Sieve of Eratosthenes.
- Store all primes in a vector.
- For a given number N, return element at (N-1)th index in a vector.
Below is the implementation of the above approach:
5th prime number is 11 16th prime number is 53 1049th prime number is 8377
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Program to find the next prime number
- Find coordinates of a prime number in a Prime Spiral
- Program to find sum of prime numbers between 1 to n
- Program to find Prime Numbers Between given Interval
- C Program to Check Whether a Number is Prime or not
- Recursive program for prime number
- Find the minimum number to be added to N to make it a prime number
- Python program to check whether a number is Prime or not
- Efficient program to print all prime factors of a given number
- C Program for efficiently print all prime factors of a given number
- Given a number x , find y such that x*y + 1 is not a prime
- Java Program for efficiently print all prime factors of a given number
- Find the position of the given Prime Number
- Find prime number K in an array such that (A[i] % K) is maximum
- Find all the prime numbers of given number of 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.
Improved By : ihritik