For example, 0 is the first lonely number and has distance 2 from the first prime. The second lonely number is 23, which has a minimal distance 4, since the surrounding primes are 17 and 29. The third is 120 which has minimal distance 7, being sandwiched between the primes 113 and 127.
The first lonely numbers are 0, 23, 53, 120, 211, 1340, 1341, 1342, 1343, 1344, 2179, 3967, 15704, 15705, 16033, 19634, 19635, 24281, 31428, 31429, 31430, 31431, 31432, 31433, 38501 more terms