login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

A375926
Numbers k such that A018252(k+1) = A018252(k) + 1. In other words, the k-th nonprime number is 1 less than the next.
10
4, 5, 8, 9, 12, 13, 15, 16, 17, 18, 21, 22, 23, 24, 26, 27, 30, 31, 33, 34, 35, 36, 38, 39, 40, 41, 44, 45, 46, 47, 49, 50, 53, 54, 55, 56, 58, 59, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 73, 74, 77, 78, 81, 82, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95
OFFSET
1,1
EXAMPLE
The nonprime numbers are 1, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, ... which increase by 1 after term 4, term 5, term 8, etc.
MATHEMATICA
Join@@Position[Differences[Select[Range[100], !PrimeQ[#]&]], 1]
PROG
(Python)
from sympy import primepi
def A375926(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+1+y))-1
return bisection(f, n, n) # Chai Wah Wu, Sep 15 2024
CROSSREFS
The complement appears to be A014689, except the first term.
Positions of 1's in A065310 (see also A054546, A073783).
First differences are A373403 (except first).
The version for non-prime-powers is A375713, differences A373672.
The version for prime-powers is A375734, differences A373671.
The version for non-perfect-powers is A375740.
The version for composite numbers is A375929.
A000040 lists the prime numbers, differences A001223.
A018252 lists the nonprimes, exclusive A002808.
A046933 counts composite numbers between primes.
Sequence in context: A378594 A284906 A285260 * A190671 A042948 A338062
KEYWORD
nonn
AUTHOR
Gus Wiseman, Sep 11 2024
STATUS
approved