A077284 Duplicate of A070428.
1, 4, 13, 41, 125, 367, 1111, 3395, 10491, 32670, 102231, 320990, 1010196, 3184138
Offset: 0
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.
import Data.Map (singleton, findMin, deleteMin, insert) a001597 n = a001597_list !! (n-1) (a001597_list, a025478_list, a025479_list) = unzip3 $ (1, 1, 2) : f 9 (3, 2) (singleton 4 (2, 2)) where f zz (bz, ez) m | xx < zz = (xx, bx, ex) : f zz (bz, ez+1) (insert (bx*xx) (bx, ex+1) $ deleteMin m) | xx > zz = (zz, bz, 2) : f (zz+2*bz+1) (bz+1, 2) (insert (bz*zz) (bz, 3) m) | otherwise = f (zz+2*bz+1) (bz+1, 2) m where (xx, (bx, ex)) = findMin m -- bx ^ ex == xx -- Reinhard Zumkeller, Mar 28 2014, Oct 04 2012, Apr 13 2012
[1] cat [n : n in [2..1000] | IsPower(n) ];
isA001597 := proc(n) local e ; e := seq(op(2,p),p=ifactors(n)[2]) ; return ( igcd(e) >=2 or n =1 ) ; end proc: A001597 := proc(n) option remember; local a; if n = 1 then 1; else for a from procname(n-1)+1 do if isA001597(a) then return a ; end if; end do; end if; end proc: seq(A001597(n),n=1..70) ; # R. J. Mathar, Jun 07 2011 N:= 10000: # to get all entries <= N sort({1,seq(seq(a^b, b = 2 .. floor(log[a](N))), a = 2 .. floor(sqrt(N)))}); # Robert FERREOL, Jul 18 2023
min = 0; max = 10^4; Union@ Flatten@ Table[ n^expo, {expo, Prime@ Range@ PrimePi@ Log2@ max}, {n, Floor[1 + min^(1/expo)], max^(1/expo)}] (* T. D. Noe, Apr 18 2011; slightly modified by Robert G. Wilson v, Aug 11 2014 *) perfectPowerQ[n_] := n == 1 || GCD @@ FactorInteger[n][[All, 2]] > 1; Select[Range@ 1765, perfectPowerQ] (* Ant King, Jun 29 2013; slightly modified by Robert G. Wilson v, Aug 11 2014 *) nextPerfectPower[n_] := If[n == 1, 4, Min@ Table[ (Floor[n^(1/k)] + 1)^k, {k, 2, 1 + Floor@ Log2@ n}]]; NestList[ nextPerfectPower, 1, 55] (* Robert G. Wilson v, Aug 11 2014 *) Join[{1},Select[Range[2000],GCD@@FactorInteger[#][[All,2]]>1&]] (* Harvey P. Dale, Apr 30 2018 *)
{a(n) = local(m, c); if( n<2, n==1, c=1; m=1; while( cMichael Somos, Aug 05 2009 */
is(n)=ispower(n) || n==1 \\ Charles R Greathouse IV, Sep 16 2015
list(lim)=my(v=List(vector(sqrtint(lim\=1),n,n^2))); for(e=3,logint(lim,2), for(n=2,sqrtnint(lim,e), listput(v,n^e))); Set(v) \\ Charles R Greathouse IV, Dec 10 2019
from sympy import perfect_power def ok(n): return n==1 or perfect_power(n) print([m for m in range(1, 1765) if ok(m)]) # Michael S. Branicky, Jan 04 2021
import sympy class A001597() : def _init_(self) : self.a = [1] def at(self, n): if n <= len(self.a): return self.a[n-1] else: cand = self.at(n-1)+1 while sympy.perfect_power(cand) == False: cand += 1 self.a.append(cand) return cand a001597 = A001597() for n in range(1,20): print(a001597.at(n)) # R. J. Mathar, Mar 28 2023
from sympy import mobius, integer_nthroot def A001597(n): def f(x): return int(n-2+x+sum(mobius(k)*(integer_nthroot(x,k)[0]-1) for k in range(2,x.bit_length()))) kmin, kmax = 1,2 while f(kmax) >= kmax: kmax <<= 1 while True: kmid = kmax+kmin>>1 if f(kmid) < kmid: kmax = kmid else: kmin = kmid if kmax-kmin <= 1: break return kmax # Chai Wah Wu, Aug 13 2024
def A001597_list(n) : return [k for k in (1..n) if k.is_perfect_power()] A001597_list(1764) # Peter Luschny, Feb 03 2012
a(3)=200 because 200=2^3*5^2, both 3 and 2 are greater than 1, and the highest common factor of 3 and 2 is 1. Factorizations of a(1) to a(20): 72 = 2^3 3^2, 108 = 2^2 3^3, 200 = 2^3 5^2, 288 = 2^5 3^2, 392 = 2^3 7^2, 432 = 2^4 3^3, 500 = 2^2 5^3, 648 = 2^3 3^4, 675 = 3^3 5^2, 800 = 2^5 5^2, 864 = 2^5 3^3, 968 = 2^3 11^2, 972 = 2^2 3^5, 1125 = 3^2 5^3, 1152 = 2^7 3^2, 1323 = 3^3 7^2, 1352 = 2^3 13^2, 1372 = 2^2 7^3, 1568 = 2^5 7^2, 1800 = 2^3 3^2 5^2. Examples for a(n) = (s(n))^2 * f(n): (see above comment) s(n) = 6, 6, 10, 12, 14, 12, 10, 18, 15, 20, 12, 22, 18, 15, 24, 21, f(n) = 2, 3, 2, 2, 2, 3, 5, 2, 3, 2, 6, 2, 3, 5, 2, 3,
filter:= proc(n) local E; E:= map(t->t[2], ifactors(n)[2]); min(E)>1 and igcd(op(E))=1 end proc: select(filter,[$1..10000]); # Robert Israel, Aug 11 2014
achillesQ[n_] := Block[{ls = Last /@ FactorInteger@n}, Min@ ls > 1 == GCD @@ ls]; Select[ Range@ 5500, achillesQ@# &] (* Robert G. Wilson v, Jun 10 2010 *)
is(n)=my(f=factor(n)[,2]); n>9 && vecmin(f)>1 && gcd(f)==1 \\ Charles R Greathouse IV, Sep 18 2015, replacing code by M. F. Hasler, Sep 23 2010
from math import gcd from itertools import count, islice from sympy import factorint def A052486_gen(startvalue=1): # generator of terms >= startvalue return (n for n in count(max(startvalue,1)) if (lambda x: all(e > 1 for e in x) and gcd(*x) == 1)(factorint(n).values())) A052486_list = list(islice(A052486_gen(),20)) # Chai Wah Wu, Feb 19 2022
from math import isqrt from sympy import mobius, integer_nthroot def A052486(n): def squarefreepi(n): return int(sum(mobius(k)*(n//k**2) for k in range(1, isqrt(n)+1))) 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): c, l = n+x+1, 0 j = isqrt(x) while j>1: k2 = integer_nthroot(x//j**2,3)[0]+1 w = squarefreepi(k2-1) c -= j*(w-l) l, j = w, isqrt(x//k2**3) c -= squarefreepi(integer_nthroot(x,3)[0])-l+sum(mobius(k)*(integer_nthroot(x, k)[0]-1) for k in range(2, x.bit_length())) return c return bisection(f,n,n) # Chai Wah Wu, Sep 10 2024
For n=3, the perfect powers smaller than 2^3=8 are: 1 and 4. So a(3) = 2.
Join[{0,1}, Table[-Sum[MoebiusMu[x]*Floor[2^(n/x) - 1], {x, 2, n}], {n, 2, 50}]]
a(n) = sum(k=1, 2^n-1, (k==1) || ispower(k)); \\ Michel Marcus, Apr 11 2016
from sympy import mobius, integer_nthroot def A188951(n): return int(sum(mobius(x)*(1-integer_nthroot(1<Chai Wah Wu, Aug 13 2024
a(2) = 8 because there are eight 2-digit perfect powers: 16, 25, 27, 32, 36, 49, 64, 81. a(3) = 28 = A070428(3) - A070428(2) = 41 - 13 (in A070428 offset is 0).
from sympy import mobius, integer_nthroot def A075308(n): return int(sum(mobius(x)*(integer_nthroot(10**(n-1),x)[0]-integer_nthroot(10**n,x)[0]) for x in range(2,((10**(n-1)).bit_length())))-sum(mobius(x)*(integer_nthroot(10**n,x)[0]-1) for x in range((10**(n-1)).bit_length(),(10**n).bit_length()))) if n>2 else n<<2 # Chai Wah Wu, Aug 13 2024
For n=2, the 11 perfect powers > 1 below 10^2 = 100 are: 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81. - _Michael B. Porter_, Jul 18 2016
Table[lim=10^n-1; Sum[ -(Floor[lim^(1/k)]-1)*MoebiusMu[k], {k,2,Floor[Log[2,lim]]}], {n,30}] (* T. D. Noe, Nov 16 2006 *)
from sympy import mobius, integer_nthroot def A089579(n): return int(sum(mobius(x)*(1-integer_nthroot(10**n,x)[0]) for x in range(2,(10**n).bit_length())))-1 if n>1 else 3 # Chai Wah Wu, Aug 13 2024
def A089579(n): gen = (p for p in srange(2, 10^n) if p.is_perfect_power()) return sum(1 for _ in gen) print([A089579(n) for n in range(1, 7)]) # Peter Luschny, Sep 15 2023
How many powers are there not exceeding 2^4?: 1, 4, 8, 9, 16. Hence a(4) = 5. a(22)=2224: there are 2224 powers not exceeding 2^22.
f[n_] := 1 - Sum[ MoebiusMu[x]*Floor[2^(n/x) - 1], {x, 2, n}]; Array[f, 44, 0] (* Robert G. Wilson v, Jan 20 2015 *)
a(n) = 1 - sum(k=2, n, moebius(k)*(sqrtnint(2^n,k)-1));
from sympy import mobius, integer_nthroot def A070228(n): return int(1+sum(mobius(x)*(1-integer_nthroot(1<Chai Wah Wu, Aug 13 2024
a(6) = 0 because there is no way to write 6 as a nontrivial perfect power. a(9) = 1 because there is one way to write 9 as a nontrivial perfect power: 3^2. a(16) = 2 because there are two ways to write 16 as a nontrivial perfect power: 2^4, 4^2. From _Friedjof Tellkamp_, Jun 14 2025: (Start) n: 1, 2, 3, 4, 5, 6, 7, 8, 9, ... Squares: 1, 0, 0, 1, 0, 0, 0, 0, 1, ... (A010052) Cubes: 1, 0, 0, 0, 0, 0, 0, 1, 0, ... (A010057) ... Sum: oo, 0, 0, 1, 0, 0, 0, 1, 1, ... a(1)=1: 1, 0, 0, 1, 0, 0, 0, 1, 1, ... (= this sequence). (End)
a[n_] := If[n == 1, 1, Sum[Boole[IntegerQ[n^(1/k)]], {k, 2, Floor[Log[2, n]]}]]; Array[a, 100] (* Friedjof Tellkamp, Jun 14 2025 *) a[n_] := If[n == 1, 1, DivisorSigma[0, Apply[GCD, Transpose[FactorInteger[n]][[2]]]] - 1]; Array[a, 100] (* Michael Shamos, Jul 06 2025 *)
a(n) = if (n==1, 1, sum(i=2, logint(n, 2), ispower(n, i))); \\ Michel Marcus, Apr 11 2025
a(2) = A089580(2)-A089579(2) = 4 because of the three terms: 16 = 2^4 = 4^2, 64 = 2^6 = 4^3 = 8^2 and 81 = 3^4 = 9^2; one for 16, two for 64 and one for 81 making a total of 4.
f[n_] := Block[{lim = 10^n -1}, Sum[ (Floor[ lim^(1/k)] - 1)(1 + MoebiusMu[k]), {k, 2, Floor[ Log[2, lim]]}]]; Array[f, 36]
There are 2 cubefull numbers not exceeding 10, 1 and 8, therefore a(1) = 2.
a[n_] := Module[{max = 10^n}, CountDistinct@ Flatten@ Table[i^5 * j^4 * k^3, {i, Surd[max, 5]}, {j, Surd[max/i^5, 4]}, {k, CubeRoot[max/(i^5*j^4)]}]]; Array[a, 15, 0]
from math import gcd from sympy import factorint, integer_nthroot def A362973(n): m, c = 10**n, 0 for x in range(1,integer_nthroot(m,5)[0]+1): if all(d<=1 for d in factorint(x).values()): for y in range(1,integer_nthroot(z:=m//x**5,4)[0]+1): if gcd(x,y)==1 and all(d<=1 for d in factorint(y).values()): c += integer_nthroot(z//y**4,3)[0] return c # Chai Wah Wu, May 11-13 2023
Comments