Mathematical foundation
A local prime gap is the difference between consecutive primes that surround the chosen location. If the input itself is prime, this page reports the gap from that prime to the next one. Prime Gap also connects with next prime.
Reading prime gap correctly starts with the mathematical structure described here.
Problems this can answer
Prime gaps describe how irregularly primes occupy the number line and help compare the search range around a proposed modulus. A related application of Prime Gap is previous prime.
Boundaries and common traps
The convention at a prime input matters; this calculator uses that prime as the lower endpoint. Very large searches are restricted to safe integers.
Reversing the displayed steps offers a quick independent check on this prime gap result.
Follow one set of numbers
Around 100, the neighboring primes are 97 and 101. Their difference is four. This Prime Gap example can be compared with classify the input.
Reproducing the answer
Find the lower prime at or below the input and the first prime above it, then subtract the lower endpoint from the upper endpoint.
Using the result beyond this page
Start the prime gap setup by pairing every source number with integer between the primes. Convert unlike units before typing, and postpone rounding until the displayed prime gap is ready to report.
How Prime Gap responds to input changes
Moving inside the same pair of consecutive primes leaves the reported gap unchanged. Use that direction of change to check the displayed prime gap before copying it elsewhere.
Precision and reporting
When copying the result elsewhere, include its label and any squared, linear, angular, or percentage unit implied by the inputs. That record distinguishes a calculated prime gap from an unlabeled number and makes later checking substantially easier.
The gap is a distance between primes, not the count of composite integers strictly between them. Keep that boundary in mind when interpreting the numerical result.
For later verification, record integer between the primes before rounding the prime gap. The unrounded working value can feed subsequent steps while the rounded value serves presentation.
Reading the endpoints
A gap should be recorded with its endpoint primes, not only as a width. The value four could describe 7 to 11, 13 to 17, or many later pairs. Keeping both endpoints makes the result reproducible and clarifies whether the chosen input was itself the lower prime.