cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A377043 The n-th perfect-power A001597(n) minus the n-th power of a prime A000961(n).

This page as a plain text file.
%I A377043 #10 Oct 27 2024 13:02:31
%S A377043 0,2,5,5,11,18,19,23,25,36,48,64,81,98,100,101,115,138,164,179,184,
%T A377043 200,209,240,271,284,300,336,374,413,439,450,495,542,587,632,683,738,
%U A377043 793,852,887,903,964,1029,1097,1165,1194,1230,1295,1370,1443,1518,1561
%N A377043 The n-th perfect-power A001597(n) minus the n-th power of a prime A000961(n).
%C A377043 Perfect-powers (A001597) are numbers with a proper integer root.
%F A377043 a(n) = A001597(n) - A000961(n).
%t A377043 perpowQ[n_]:=n==1||GCD@@FactorInteger[n][[All,2]]>1;
%t A377043 per=Select[Range[1000],perpowQ];
%t A377043 per-NestList[NestWhile[#+1&,#+1,!PrimePowerQ[#]&]&,1,Length[per]-1]
%o A377043 (Python)
%o A377043 from sympy import mobius, primepi, integer_nthroot
%o A377043 def A377043(n):
%o A377043     def bisection(f,kmin=0,kmax=1):
%o A377043         while f(kmax) > kmax: kmax <<= 1
%o A377043         while kmax-kmin > 1:
%o A377043             kmid = kmax+kmin>>1
%o A377043             if f(kmid) <= kmid:
%o A377043                 kmax = kmid
%o A377043             else:
%o A377043                 kmin = kmid
%o A377043         return kmax
%o A377043     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 A377043     def g(x): return int(n-1+x-sum(primepi(integer_nthroot(x,k)[0]) for k in range(1,x.bit_length())))
%o A377043     return bisection(f,n,n)-bisection(g,n,n) # _Chai Wah Wu_, Oct 27 2024
%Y A377043 Excluding 1 from the powers of primes gives A377044.
%Y A377043 A000015 gives the least prime-power >= n.
%Y A377043 A031218 gives the greatest prime-power <= n.
%Y A377043 A000040 lists the primes, differences A001223.
%Y A377043 A000961 lists the powers of primes, differences A057820.
%Y A377043 A001597 lists the perfect-powers, differences A053289, seconds A376559.
%Y A377043 A007916 lists the non-perfect-powers, differences A375706, seconds A376562.
%Y A377043 A024619 lists the non-prime-powers, differences A375735, seconds A376599.
%Y A377043 A025475 lists numbers that are both a perfect-power and a prime-power.
%Y A377043 A080101 counts prime-powers between primes (exclusive).
%Y A377043 A106543 lists numbers that are neither a perfect-power nor a prime-power.
%Y A377043 A131605 lists perfect-powers that are not prime-powers.
%Y A377043 A246655 lists the prime-powers, complement A361102 (differences A375708).
%Y A377043 Prime-power runs: A373675, min A373673, max A373674, length A174965.
%Y A377043 Prime-power antiruns: A373576, min A120430, max A006549, length A373671.
%Y A377043 Cf. A023055, A045542, A052410, A053707, A069623, A110969, A216765, A377051.
%K A377043 nonn
%O A377043 1,2
%A A377043 _Gus Wiseman_, Oct 25 2024