In mathematics, Bertrand’s Postulate states that there is a prime number in the range to where n is a natural number and n >= 4. It has been proved by Chebyshev and later by Ramanujan. A lenient form of the postulate states that there exists a prime in range n to 2n for any n(n >= 2).
There exists a prime p for for all n <= 4. The less stricter form states that there exists a prime p. For for all n <= 2.
For n = 4 and 2*n – 2 = 6,
5 is a prime number in the range (4, 6).
For n = 5 and 2*n – 2 = 8,
7 is a prime number in the range (5, 8).
For n = 6 and 2*n – 2 = 10,
7 is a prime number in the range (6, 10).
For n = 7 and 2*n – 2 = 12,
11 is a prime number in the range (7, 12).
For n = 8 and 2*n – 2 = 14,
11 is a prime number in the range (8, 14).
Input: n = 4 Output: Prime numbers in range (4, 6) 5 Input: n = 5 Output: Prime numbers in range (5, 8) 7 Input: n = 6 Output: Prime numbers in range (6, 10) 7
Prime numbers in range (10, 18) 11 13 17
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Count of numbers upto N having absolute difference of at most K between any two adjacent digits
- Length of longest subarray whose sum is not divisible by integer K
- Largest subset having with sum less than equal to sum of respective indices
- Create matrix whose sum of diagonals in each sub matrix is even
- Min operations to reduce N to 1 by multiplying by A or dividing by B
- Min operations to reduce N by multiplying by any number or taking square root
- Least root of given quadratic equation for value greater than equal to K
- Median of sliding window in an array | Set 2
- Kth diagonal from the top left of a given matrix
- Construct a sequence from given frequencies of N consecutive integers with unit adjacent difference
- Check if frequency of each element in given array is unique or not
- How to store a very large number of more than 100 digits in C++
- Generalized Fibonacci Numbers
- Check if an N-sided Polygon is possible from N given angles
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.