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.
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
Keywords
Examples
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.
Crossrefs
Programs
-
Mathematica
Join@@Position[Differences[Select[Range[100],!PrimeQ[#]&]],1]
-
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