A376559 Second differences of consecutive perfect powers (A001597). First differences of A053289.
1, -3, 6, 2, -7, 3, -1, 9, 2, 2, 2, 2, -17, -1, 13, 9, 2, -7, -11, 9, -5, 20, 2, -16, -1, 21, 2, 2, -15, -11, 30, 2, 2, 2, 2, 2, 2, 2, -22, -15, 41, 2, 2, 2, -36, 3, 37, 2, 2, 2, -34, -11, 49, 2, 2, -66, 45, 3, -61, 2, 83, 2, 2, 2, 2, -63, 25, 42, 2, -9, -89
Offset: 1
Keywords
Examples
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, ...
Crossrefs
Programs
-
Mathematica
perpowQ[n_]:=n==1||GCD@@FactorInteger[n][[All,2]]>1; Differences[Select[Range[1000],perpowQ],2]
-
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
-
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
Comments