This calculator finds the largest prime number inside your chosen range. It also shows the previous prime, the prime gap, candidate checks, estimated local density, export tools, and a visual prime map.
Calculator Input
Use an upper limit to search downward. Add a lower limit to constrain the range. Increase maximum checks when scanning wider intervals.
Example Data Table
| Lower Limit | Upper Limit | Largest Prime | Previous Prime | Prime Gap |
|---|---|---|---|---|
| 2 | 100 | 97 | 89 | 8 |
| 500 | 1000 | 997 | 991 | 6 |
| 10000 | 10500 | 10499 | 10487 | 12 |
| 100000 | 100500 | 100493 | 100483 | 10 |
Formula Used
Largest prime in a range:
P = max { p ∈ ℤ : L ≤ p ≤ U, p > 1, and p is prime }
Prime condition:
A number n is prime when it has exactly two positive divisors: 1 and n.
Miller–Rabin setup:
Write n − 1 = d × 2s, where d is odd. Then test whether ad mod n reaches 1 or n − 1 for fixed witness bases. This version is deterministic for signed 64-bit integer inputs.
Local density estimate:
Prime density near n ≈ 1 / ln(n). The calculator shows this as a percentage for quick interpretation.
How to Use This Calculator
- Enter a lower limit, or leave it near 2 for a broad search.
- Enter the upper limit where the downward prime search should begin.
- Set the maximum candidate checks to control runtime on wider ranges.
- Choose how many nearby lower primes you want in the report.
- Set the chart window size to control the visual neighborhood.
- Keep odd-only scanning enabled for faster searches in most cases.
- Click Find Largest Prime to display the result above the form.
- Use the CSV and PDF buttons to export your calculation summary.
FAQs
1) What does this calculator actually find?
It finds the largest prime number inside your selected interval. Most users set a high upper limit and search downward until the first prime appears.
2) Is there a largest prime number overall?
No. There is no final largest prime. Prime numbers continue forever, so this tool finds the largest prime only within your chosen search range.
3) Why can searches take longer for some inputs?
Large ranges, wide prime gaps, and very high limits require more candidate checks. Increasing the search span raises the amount of primality testing needed.
4) Why are only positive integers accepted?
Prime numbers are defined here for positive integers greater than 1. Fractions, decimals, and negative values do not fit this calculator’s range search model.
5) How accurate is the primality test?
This calculator uses a deterministic Miller–Rabin setup valid for signed 64-bit integer inputs. Within that range, the prime decision is reliable.
6) What is a prime gap?
A prime gap is the difference between one prime and the previous prime. It helps describe how tightly or loosely primes appear near your result.
7) Can I use extremely large values?
You can use large integer values up to your server’s signed integer limit. Very large inputs may still need more time or a higher maximum check setting.
8) Why show nearby lower primes and the chart?
They provide context. Nearby primes show local spacing, while the chart reveals where prime and composite numbers cluster around the largest prime found.