OFFSET
1,10
COMMENTS
For the exclusive version, shift left once.
EXAMPLE
The prime-powers inclusive (A000961) are:
1, 2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 17, 19, 23, 25, 27, 29, 31, 32, 37, 41, 43, ...
with first differences (A057820):
1, 1, 1, 1, 2, 1, 1, 2, 2, 3, 1, 2, 4, 2, 2, 2, 2, 1, 5, 4, 2, 4, 2, 4, 6, 2, 3, ...
with first differences (A376596):
0, 0, 0, 1, -1, 0, 1, 0, 1, -2, 1, 2, -2, 0, 0, 0, -1, 4, -1, -2, 2, -2, 2, 2, ...
MATHEMATICA
Differences[Select[Range[1000], #==1||PrimePowerQ[#]&], 2]
PROG
(Python)
from sympy import primepi, integer_nthroot
def A376596(n):
def iterfun(f, n=0):
m, k = n, f(n)
while m != k: m, k = k, f(k)
return m
def f(x): return int(n+x-1-sum(primepi(integer_nthroot(x, k)[0]) for k in range(1, x.bit_length())))
return (a:=iterfun(f, n))-((b:=iterfun(lambda x:f(x)+1, a))<<1)+iterfun(lambda x:f(x)+2, b) # Chai Wah Wu, Oct 02 2024
CROSSREFS
A064113 lists positions of adjacent equal prime gaps.
For prime-powers inclusive: A057820 (first differences), A376597 (inflections and undulations), A376598 (nonzero curvature).
KEYWORD
sign
AUTHOR
Gus Wiseman, Oct 02 2024
STATUS
approved