cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A371694 a(1) = 2; a(n+1) is the larger prime between nextprime(a(n)) and prevprime(a(n)+n-m+1), where m is the number of primes < a(n) that are missing from the sequence.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 19, 23, 29, 37, 43, 47, 53, 61, 71, 79, 89, 97, 107, 113, 127, 137, 139, 151, 163, 173, 181, 193, 199, 211, 223, 233, 241, 251, 263, 277, 283, 293, 307, 317, 331, 337, 353, 367, 379, 389, 401, 409, 421, 433, 449, 463, 467, 479, 491, 503
Offset: 1

Views

Author

Ya-Ping Lu, Apr 03 2024

Keywords

Comments

The first missing prime in the sequence is 17. First occurrence of a(n)+n-m < nextprime(a(n)) is at n = 20 (see Examples). It seems that 1/2 < n/(n+m) <= 1 and lim_{n->oo} n/(n+m) = 1/2 (or half of the primes are in this sequence).

Examples

			primes    2 3 5  7 11 13 17 19 23 29 31 37 41 43 ..  97 101 103 107 109 113 127
n         1 2 3  4  5  6     7  8  9    10    11 ..  18          19      20  21
a(n)      2 3 5  7 11 13    19 23 29    37    43 ..  97         107     113 127
m         0 0 0  0  0  0     1  1  1     2     3 ..   7           9      10  10
a(n)+n-m  3 5 8 11 16 19    25 30 37    45    51 .. 108         117     123 138
a(n+1)    3 5 7 11 13 19    23 29 37    43    47 .. 107         113     127 137
		

Crossrefs

Cf. A362527.

Programs

  • Python
    from sympy import primerange, prevprime, nextprime; p = 2; b = 0
    for n in range(1, 57): print(p, end = ", "); q = max(nextprime(p), prevprime(p + n - b + 1)); m = len(list(primerange(p+1, q))); p = q; b += m