OFFSET
0,3
COMMENTS
Let G = A001223(1..n) be the first n prime gaps, and H = sort(G) the sequence of the same terms but in nondecreasing order. Then a(n) counts the zeros in G-H.
StackExchange user Daniel Tisdale described this sequence in 2014 and observed that the sequence appeared to grow like primepi(n) ~ n/log(n). It is not presently known if that is true.
LINKS
Daniel Tisdale, Sorting of prime gaps, math.StackExchange.com, Aug. 11, 2014.
PROG
(PARI) apply( {A369858(n, p=primes(n+1))=#[0|d<-vecsort(p=p[^1]-p[^-1])-p, !d]}, [0..99]) \\ M. F. Hasler, Apr 24 2024
(Python)
from sympy import prime
A1223=[] # this list starts at index 0, unlike function A001223
def A369858(n):
if (L:= len(A1223)) < n:
A1223.extend(prime(k+2)-prime(k+1) for k in range(L, n))
return sum(a==b for a, b in zip(A1223[:n], sorted(A1223[:n]))) # M. F. Hasler, Apr 26 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Apr 24 2024
STATUS
approved