login
The n-th perfect-power A001597(n) minus the n-th prime-power A246655(n).
2

%I #11 Oct 27 2024 12:12:13

%S -1,1,4,4,9,17,18,21,23,33,47,62,77,96,98,99,113,137,159,175,182,196,

%T 207,236,265,282,297,333,370,411,433,448,493,536,579,628,681,734,791,

%U 848,879,899,962,1028,1094,1159,1192,1220,1293,1364,1437,1514,1559,1591

%N The n-th perfect-power A001597(n) minus the n-th prime-power A246655(n).

%C Perfect-powers (A001597) are numbers with a proper integer root.

%F a(n) = A001597(n) - A246655(n).

%t perpowQ[n_]:=n==1||GCD@@FactorInteger[n][[All,2]]>1;

%t per=Select[Range[1000],perpowQ];

%t per-NestList[NestWhile[#+1&, #+1,!PrimePowerQ[#]&]&,2,Length[per]-1]

%o (Python)

%o from sympy import mobius, primepi, integer_nthroot

%o def A377044(n):

%o def bisection(f,kmin=0,kmax=1):

%o while f(kmax) > kmax: kmax <<= 1

%o while kmax-kmin > 1:

%o kmid = kmax+kmin>>1

%o if f(kmid) <= kmid:

%o kmax = kmid

%o else:

%o kmin = kmid

%o return kmax

%o 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())))

%o def g(x): return int(n+x-sum(primepi(integer_nthroot(x,k)[0]) for k in range(1,x.bit_length())))

%o return bisection(f,n,n)-bisection(g,n,n) # _Chai Wah Wu_, Oct 27 2024

%Y Including 1 with the prime-powers gives A377043.

%Y A000015 gives the least prime-power >= n.

%Y A000040 lists the primes, differences A001223.

%Y A000961 lists the powers of primes, differences A057820, A093555, A376596.

%Y A001597 lists the perfect-powers, differences A053289, seconds A376559.

%Y A007916 lists the non-perfect-powers, differences A375706, seconds A376562.

%Y A024619 lists the non-prime-powers, differences A375735, seconds A376599.

%Y A025475 lists numbers that are both a perfect-power and a prime-power.

%Y A031218 gives the greatest prime-power <= n.

%Y A080101 counts prime-powers between primes (exclusive).

%Y A106543 lists numbers that are neither a perfect-power nor a prime-power.

%Y A131605 lists perfect-powers that are not prime-powers.

%Y A246655 lists the prime-powers, complement A361102, A375708.

%Y Prime-power runs: A373675, min A373673, max A373674, length A174965.

%Y Prime-power antiruns: A373576, min A120430, max A006549, length A373671.

%Y Cf. A023055, A045542, A052410, A053707, A069623, A110969, A216765, A376560, A376561, A377051.

%K sign

%O 1,3

%A _Gus Wiseman_, Oct 25 2024