Husk, 9 bytes
Try it online!
This is a really interesting question allowing a range of possible approaches (and Husk is a good fit for it; I learned the language for the challenge).
The TIO link contains a wrapper to run this function on all inputs from 1 to 10.
İp The (infinite) list of primes
ġ Group them, putting adjacent primes in the same group if
- the difference between them
<⁰ is less than the input
o (fix for a parser ambiguity that causes this parse to be chosen)
→ Take the last element of
← the first group
Grouping primes that are too close together means that the first break in the groups will be the first point at which the primes are sufficiently far apart, so we simply just need to find the prime just after the break.
Other potential solutions
Here's an 8-byte solution that, sadly, only works with even numbers as input (and thus isn't valid):
N On the infinite list of natural numbers
m replace each element with
ṗ 0 if composite, or a distinct number if prime
U Find the longest prefix with no repeated sublist of length
⁰ equal to the input
-⁰ Subtract the input from
L the length of that prefix
The idea is that when we have two primes that are a distance of (say) 6 apart, there'll be a sequence of five consecutive zeroes in the
mṗN sequence, which contains two identical sublists of length 4 (the first four zeroes and last four zeroes), but such a repetition cannot happen earlier (because as each prime is mapped to a unique number, any length-4 substrings before the first prime gap > 4 will contain a prime number, and the substring will therefore be unique as it's the only substring which contains that number in that position). Then we just have to subtract the trailing zeroes from the length of the prefix to get our answer.
This doesn't work with odd inputs because the sublist of input zeroes only occurs once rather than twice, so the code ends up finding the second point at which it occurs rather than the first.