Ramanujan Prime Calculator
Primes
- Bertrand's postulate says pi(x) - pi(x / 2) >= 1 for all x >= 2; Ramanujan primes generalize it: R_n is the smallest x from which pi(x) - pi(x / 2) >= n for all larger x.
- Computing pi(x) - pi(x / 2) on a sieve up to 2,000, the last x where the count falls below 10 is 96.
- So R_10 = 97: from 97 onward there are always at least 10 primes between x / 2 and x.
- Check at the point itself: pi(97) - pi(48) = 10.
This Ramanujan Prime Calculator finds the nth Ramanujan prime, written R_n. The nth Ramanujan prime is the smallest integer from which pi(x) - pi(x / 2) >= n holds for all larger x — meaning that at least n primes always lie between x/2 and x. Enter a value for n and the calculator returns R_n. The first ten Ramanujan primes are 2, 11, 17, 29, 41, 47, 59, 67, 71 and 97, so 47 is the 6th Ramanujan prime. For a check, R_10 = 97, and indeed pi(97) - pi(48) = 25 - 15 = 10. R_1 = 2 restates Bertrand's postulate: there is always a prime between x/2 and x.
The calculator applies the definition of the Ramanujan prime directly, testing the count of primes between x/2 and x against n, so the result rests on the same condition that defines the sequence rather than on a shortcut or a lookup alone. That is why the method is the accepted standard for this kind of calculation. On this page you will find the formula, step-by-step workings, worked examples and sources, so you can follow how each answer is produced and verify it yourself.
Worked examples
the 10th Ramanujan prime
(nth Ramanujan prime · 10)
| R_10 — the 10th Ramanujan prime | 97 |
| previous Ramanujan prime | 71 |
| next Ramanujan prime | 101 |
| pi(R) - pi(R / 2) at R | 10 |
the 5th Ramanujan prime
(nth Ramanujan prime · 5)
| R_5 — the 5th Ramanujan prime | 41 |
| previous Ramanujan prime | 29 |
| next Ramanujan prime | 47 |
| pi(R) - pi(R / 2) at R | 5 |
is 47 a Ramanujan prime?
(check a value · 47)
| is 47 a Ramanujan prime? | Yes |
| its Ramanujan rank | 6 |
| pi(n) - pi(n / 2) at n | 6 |
| nearest Ramanujan prime at or below n | 47 |
What is a Ramanujan prime?
A Ramanujan prime is best understood through a counting question: for a given number x, how many primes lie between x/2 and x? Write pi(x) for the number of primes up to x. Then the count of primes in that upper half of the range from 1 to x is pi(x) - pi(x/2). Ramanujan studied how this difference behaves as x grows, and his result is what gives the Ramanujan prime its definition.
The nth Ramanujan prime, written R_n, is the smallest integer from which pi(x) - pi(x/2) >= n holds for all larger x. In plain terms, starting at R_n and continuing for every larger value, at least n primes always lie between x/2 and x. So a Ramanujan prime marks the point where a guarantee of n primes in that interval becomes permanent: it holds at R_n and never fails afterward.
The first ten Ramanujan primes are 2, 11, 17, 29, 41, 47, 59, 67, 71, 97. A concrete check shows how the definition works. R_10 = 97, and indeed pi(97) - pi(48) = 25 - 15 = 10. There are 25 primes up to 97 and 15 primes up to 48, leaving 10 primes between 48 and 97. Because 97 is the smallest integer with this property holding from that point on, it is the 10th Ramanujan prime. For another example, 47 is the 6th Ramanujan prime.
The definition connects directly to a classical result. R_1 = 2 restates Bertrand's postulate: there is always a prime between x/2 and x. Ramanujan's 1919 work strengthened Bertrand's postulate by asking not just for one prime in that interval but for a guaranteed count of n primes, once x is large enough. The Ramanujan prime R_n is exactly the threshold where that stronger guarantee takes effect.
A few features of the sequence are worth noting. The values are not evenly spaced, and the gaps do not simply grow; the list begins 2, 11, 17, 29, 41, 47, 59, 67, 71, 97. The definition is stated as a condition that must hold for all larger x, not merely at a single point, which is why each term is a threshold rather than an isolated coincidence. The prime-counting difference pi(x) - pi(x/2) is the quantity being tracked throughout, and each Ramanujan prime records the first x at which that difference reaches n and stays at or above it.
How R_n is found
Finding a Ramanujan prime is a job for a sieve, not for trial and error. The definition tells you what to look for: the nth Ramanujan prime R_n is the smallest integer from which pi(x) - pi(x / 2) >= n holds for all larger x. In plain terms, from R_n onward, at least n primes always lie between x/2 and x, no matter how far out you go. The calculator builds the answer in two passes over the same list of primes.
The first pass builds pi(x), the prime-counting function, for every x up to a chosen limit. A standard sieve marks each composite, and a running total then records how many primes are at or below each integer. With that table in hand, the quantity pi(x) - pi(x / 2) can be read off for any x by two lookups and one subtraction: the number of primes up to x, minus the number of primes up to x/2, is exactly the count of primes in the interval between x/2 and x.
The second pass walks the table and tracks the last x at which the count falls below n. That position is the final failure: past it, the condition holds for all larger x. Adding 1 to that last failing x gives R_n, the smallest integer from which the inequality never fails again. This is why the computation is quick once the sieve is built: no searching for primes one at a time, just a scan of counts already computed.
The tenth Ramanujan prime shows the check in action. The first ten Ramanujan primes are 2, 11, 17, 29, 41, 47, 59, 67, 71, 97, so R_10 = 97. And indeed pi(97) - pi(48) = 25 - 15 = 10: there are 25 primes up to 97 and 15 up to 48, leaving exactly 10 primes between 48 and 97. The count meets n right at the boundary, and the scan confirms it does not drop below 10 at any larger x.
The same sieve handles small cases cleanly. R_1 = 2 restates Bertrand's postulate: there is always a prime between x/2 and x. And 47 is the 6th Ramanujan prime, which you can confirm by reading the sixth entry off the list. Running the two passes over a larger limit extends the sequence, with each new term following from the same last-failing-x rule rather than from any separate test.
The first Ramanujan primes
The definition of a Ramanujan prime is easiest to see in action. The nth Ramanujan prime, written R_n, is the smallest integer from which pi(x) - pi(x / 2) >= n holds for all larger x — meaning that at least n primes always lie between x/2 and x once x reaches R_n. The first ten values are short enough to list in full, and each one can be checked against that counting condition.
The smallest case, R_1 = 2, restates Bertrand's postulate: there is always a prime between x/2 and x. From there the values climb quickly at first — 2, 11, 17, 29, 41 — then more gently through 47, 59, 67, 71 and 97. The table below sets each of the first ten Ramanujan primes beside the count pi(R_n) - pi(R_n / 2), which equals n at every one of these points.
The last row shows the check in full detail. R_10 = 97, and indeed pi(97) - pi(48) = 25 - 15 = 10. That is, there are 25 primes up to 97 and 15 primes up to 48, so exactly 10 primes lie in the interval from 48 to 97 — enough to satisfy the condition at n = 10, with 97 being the smallest integer where it holds for all larger x.
A single entry is worth noting on its own: 47 is the 6th Ramanujan prime. Reading down the list, the sixth value is 47, and its count pi(47) - pi(23) comes to 6, matching its position. The table makes this pattern visible for every n from 1 to 10.
| n | R_n | pi(R_n) - pi(R_n / 2) |
|---|---|---|
| 1 | 2 | 1 |
| 2 | 11 | 2 |
| 3 | 17 | 3 |
| 4 | 29 | 4 |
| 5 | 41 | 5 |
| 6 | 47 | 6 |
| 7 | 59 | 7 |
| 8 | 67 | 8 |
| 9 | 71 | 9 |
| 10 | 97 | 10 |
How Ramanujan primes grow
Ramanujan primes do not appear at a steady, predictable spacing. Their definition ties each one to a counting condition, so the sequence has a growth pattern worth understanding before you use a calculator to find the next term. The nth Ramanujan prime R_n is the smallest integer from which pi(x) - pi(x / 2) >= n holds for all larger x. In plain terms, from that starting point onward, at least n primes always lie between x/2 and x. The first ten Ramanujan primes are 2, 11, 17, 29, 41, 47, 59, 67, 71 and 97 — a list that jumps quickly at the start and then settles into a denser, more regular climb.
The starting values show this unevenness clearly. R_1 = 2 restates Bertrand's postulate: there is always a prime between x/2 and x. The second Ramanujan prime is 11, a large leap from 2, and the third is 17. After that the gaps become smaller and more frequent: 29, 41, 47, 59, 67, 71, 97. The tenth value, R_10 = 97, can be checked directly. pi(97) - pi(48) = 25 - 15 = 10, so exactly ten primes lie in that interval, matching the definition. That single check shows how the counting condition, not a simple formula, decides each term.
As n rises, R_n grows roughly on the scale of twice the nth prime. The bounds that pin the value down place it in the region of the (3n)-th prime, so the sequence climbs steadily upward as n increases. The practical effect is that larger Ramanujan primes are spread farther apart in absolute terms, even though the early terms look erratic by comparison. The definition also guarantees that every Ramanujan prime is itself prime, which is part of the theorem rather than an accident of the list. So 47 is the 6th Ramanujan prime, and it is a prime number like every other entry in the sequence.
This growth behavior is why a calculator is useful. To find R_n you are not looking for a pattern in the digits but testing the counting condition pi(x) - pi(x / 2) >= n across candidate values until it holds for all larger x. The first ten terms give a quick sanity check on any result: 2, 11, 17, 29, 41, 47, 59, 67, 71, 97. If a calculation returns something outside the expected scale, comparing it against these known values and the rough size of twice the nth prime will usually reveal the error.
Understanding how Ramanujan primes grow also clarifies why the definition is phrased as a threshold that holds for all larger x. Each term marks a point after which the prime-counting inequality never fails again, so the sequence records permanent shifts in how primes are distributed, not temporary local clusters. That is the sense in which each Ramanujan prime is a milestone rather than a peak.
- R_1 = 2 restates Bertrand's postulate: a prime always lies between x/2 and x.
- The first ten Ramanujan primes: 2, 11, 17, 29, 41, 47, 59, 67, 71, 97.
- Check: pi(97) - pi(48) = 25 - 15 = 10, so R_10 = 97.
- 47 is the 6th Ramanujan prime.
- R_n grows roughly on the scale of twice the nth prime, with bounds placing it near the (3n)-th prime region.
FAQs
What is a Ramanujan prime?
A Ramanujan prime, written R_n, is the smallest x such that pi(x) - pi(x / 2) >= n for all larger x. In plain terms, from R_n onward, every number has at least n primes between half of it and itself. The condition must hold not just at R_n but for all larger values.
What is the 10th Ramanujan prime?
The 10th Ramanujan prime is 97. You can check the defining count directly: pi(97) - pi(48) = 10 exactly, meaning there are exactly 10 primes between 48 and 97. That confirms 97 is the point where the count first reaches 10 and stays at or above it for all larger x.
What is the 5th Ramanujan prime?
The 5th Ramanujan prime is 41. This means 41 is the smallest x such that pi(x) - pi(x / 2) >= 5 for all larger x. From 41 onward, every number always has at least 5 primes between half of it and itself, while smaller starting points do not guarantee that count.
Is 47 a Ramanujan prime?
Yes, 47 is a Ramanujan prime. It is the 6th Ramanujan prime, so it comes right after the 5th, which is 41. As R_6, 47 is the smallest x such that pi(x) - pi(x / 2) >= 6 holds for all larger x, meaning every number from 47 up has at least 6 primes between half of it and itself.
How do Ramanujan primes relate to Bertrand's postulate?
Ramanujan primes extend Bertrand's postulate. R_1 = 2 is Bertrand's postulate itself: at least one prime always lies between x/2 and x. Raising n strengthens the guarantee, so R_n marks where at least n primes rather than just one always fall in that same interval for every larger x.
What is the first Ramanujan prime?
The first Ramanujan prime is R_1 = 2. It is the smallest x such that pi(x) - pi(x / 2) >= 1 for all larger x, meaning that from 2 onward every number always has at least one prime between half of it and itself. This is exactly Bertrand's postulate.