OFFSET
1,1
FORMULA
a(n) = A375926(n) - 1.
EXAMPLE
The composite numbers are 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, ... which increase by 1 after positions 3, 4, 7, 8, ...
MATHEMATICA
Join@@Position[Differences[Select[Range[100], CompositeQ]], 1]
PROG
(Python)
from sympy import primepi
def A375929(n):
def bisection(f, kmin=0, kmax=1):
while f(kmax) > kmax: kmax <<= 1
while kmax-kmin > 1:
kmid = kmax+kmin>>1
if f(kmid) <= kmid:
kmax = kmid
else:
kmin = kmid
return kmax
def f(x): return n+bisection(lambda y:primepi(x+2+y))-2
return bisection(f, n, n) # Chai Wah Wu, Sep 15 2024
(Python) # faster for initial segment of sequence
from sympy import isprime
from itertools import count, islice
def agen(): # generator of terms
pic, prevc = 0, -1
for i in count(4):
if not isprime(i):
if i == prevc + 1:
yield pic
pic, prevc = pic+1, i
print(list(islice(agen(), 10000))) # Michael S. Branicky, Sep 17 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Sep 12 2024
STATUS
approved