Largest Prime Gap Calculator

Measure prime spacing within any interval using analysis. Compare records, merits, counts, and local extremes. Find standout gaps fast with clean tables and charts.

Calculator Inputs

Reset

This tool supports intervals up to 2,000,000 integers per run and range ends up to 1,000,000,000,000.

Example Data Table

Range Start Range End Highlight Threshold Top Rows Typical Use
2 1,000 10 12 Quick classroom exploration of early prime spacing.
1,000 50,000 20 15 Study how larger primes create wider gaps.
100,000 300,000 30 20 Compare local records within a denser research window.
900,000 1,100,000 40 25 Inspect larger standout gaps near one million.

Formula Used

Prime Gap
If consecutive primes are pi and pi+1, then the gap is:
gi = pi+1 - pi
Largest Prime Gap in the Interval
The calculator scans all consecutive prime pairs found in the chosen interval and returns:
max(gi)
Average Gap
If there are n measured gaps:
Average Gap = (g1 + g2 + ... + gn) / n
Prime Gap Merit
Merit normalizes the gap by the logarithm of the lower prime:
Merit = g / ln(p)
Prime Density
Density gives the share of primes in the selected interval:
Density = Number of Primes / Interval Width

How to Use This Calculator

  1. Enter the starting integer for the interval.
  2. Enter the ending integer, making sure it is larger.
  3. Set a gap threshold to highlight unusually wide gaps.
  4. Choose how many top gap rows you want listed.
  5. Pick the maximum chart points for the graph.
  6. Set merit decimals for cleaner numeric output.
  7. Press the analyze button to generate the report.
  8. Review the summary cards, graph, and ranking tables.
  9. Use the CSV or PDF buttons to export your results.

Frequently Asked Questions

1) What is a prime gap?

A prime gap is the difference between two consecutive prime numbers. For example, the gap between 23 and 29 is 6 because no other primes lie between them.

2) What does the largest gap mean here?

It means the widest spacing between consecutive primes found inside your chosen interval. The tool reports the gap size and the exact prime pair where it first appears.

3) Why do prime gaps usually get larger?

As numbers grow, primes become less frequent on average. That wider spacing tends to produce larger gaps, although the pattern remains irregular and cannot be predicted exactly.

4) What is prime gap merit?

Merit compares the observed gap to the natural logarithm of the lower prime. It helps judge whether a gap is unusually large relative to where it occurs.

5) Does the tool include primes outside my range?

No. It measures gaps only between consecutive primes found inside the interval you entered. Boundary primes outside that interval are not added to the calculations.

6) What are twin, cousin, and sexy prime pairs?

Twin primes differ by 2, cousin primes differ by 4, and sexy primes differ by 6. The calculator counts how many of each appear in your selected interval.

7) Why is there a range size limit?

The limit keeps the page responsive and prevents heavy memory use during prime generation, chart creation, and export building, especially on shared hosting environments.

8) When should I export CSV or PDF?

Use CSV when you want spreadsheet analysis or further sorting. Use PDF when you want a printable report or a quick shareable summary of the interval.

Related Calculators

extended euclidean calculatorfactor pair generator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.