OFFSET
1,2
COMMENTS
Perfect-powers A007916 are numbers with a proper integer root.
Does this sequence contain zero?
EXAMPLE
The perfect powers (A001597) are:
1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, ...
with first differences (A053289):
3, 4, 1, 7, 9, 2, 5, 4, 13, 15, 17, 19, 21, 4, 3, 16, 25, 27, 20, 9, 18, 13, ...
with first differences (A376559):
1, -3, 6, 2, -7, 3, -1, 9, 2, 2, 2, 2, -17, -1, 13, 9, 2, -7, -11, 9, -5, 20, ...
MATHEMATICA
perpowQ[n_]:=n==1||GCD@@FactorInteger[n][[All, 2]]>1;
Differences[Select[Range[1000], perpowQ], 2]
PROG
(Python)
from sympy import mobius, integer_nthroot
def A376559(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 int(n-1+x+sum(mobius(k)*(integer_nthroot(x, k)[0]-1) for k in range(2, x.bit_length())))
a = bisection(f, n, n)
b = bisection(lambda x:f(x)+1, a, a)
return a+bisection(lambda x:f(x)+2, b, b)-(b<<1) # Chai Wah Wu, Oct 02 2024
(PARI) lista(nn) = my(v = concat (1, select(ispower, [1..nn])), w = vector(#v-1, i, v[i+1] - v[i])); vector(#w-1, i, w[i+1] - w[i]); \\ Michel Marcus, Oct 02 2024
CROSSREFS
For perfect-powers: A053289 (first differences), A376560 (positive curvature), A376561 (negative curvature).
For second differences: A036263 (prime), A073445 (composite), A376562 (non-perfect-power), A376590 (squarefree), A376593 (nonsquarefree), A376596 (prime-power), A376599 (non-prime-power).
KEYWORD
sign
AUTHOR
Gus Wiseman, Sep 28 2024
STATUS
approved