%I #45 Dec 09 2023 01:45:57
%S 4,8,9,16,16,25,27,32,36,49,64,64,64,81,81,100,121,125,128,144,169,
%T 196,216,225,243,256,256,256,289,324,343,361,400,441,484,512,512,529,
%U 576,625,625,676,729,729,729,784,841,900,961,1000,1024,1024,1024,1089
%N Sorted perfect powers a^b for a, b > 1 with duplication.
%C If b is the largest integer such that n=a^b for some a > 1, then n occurs d(b)-1 times in this sequence (where d = A000005 is the number of divisors function). (This includes the case where b=1 and n does not occur in the sequence.) - _M. F. Hasler_, Jan 25 2015
%H Reinhard Zumkeller, <a href="/A072103/b072103.txt">Table of n, a(n) for n = 1..9999</a>, recomputed with new offset by _M. F. Hasler_, Jan 25 2015
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PerfectPower.html">Perfect Power</a>
%F Sum_{i>=2} Sum_{j>=2} 1/i^j = 1.
%e (a,b) = (2,4) and (4,2) both yield 2^4 = 4^2 = 16, therefore 16 is listed twice.
%e Similarly, 64 is listed 3 times since (a,b) = (2,6), (4,3) and (8,2) all yield 64.
%p N:= 2000: # to get all entries <= N
%p sort([seq(seq(a^b, b = 2 .. floor(log[a](N))), a = 2 .. floor(sqrt(N)))]); # _Robert Israel_, Jan 25 2015
%t nn=60;Take[Sort[#[[1]]^#[[2]]&/@Tuples[Range[2,nn],2]],nn] (* _Harvey P. Dale_, Oct 03 2012 *)
%o (Haskell)
%o import Data.Set (singleton, findMin, deleteMin, insert)
%o a072103 n = a072103_list !! (n-1)
%o a072103_list = f 9 3 $ Set.singleton (4,2) where
%o f zz z s
%o | xx < zz = xx : f zz z (Set.insert (x*xx, x) $ Set.deleteMin s)
%o | otherwise = zz : f (zz+2*z+1) (z+1) (Set.insert (z*zz, z) s)
%o where (xx, x) = Set.findMin s
%o -- _Reinhard Zumkeller_, Oct 04 2012
%o (PARI) is_A072103(n)=ispower(n)
%o for(n=1,999,(e=ispower(n))||next;fordiv(e,d,d>1 && print1(n","))) \\ _M. F. Hasler_, Jan 25 2015
%o (Python)
%o import numpy
%o from math import isqrt
%o upto = 1090
%o A072103 = []
%o for m in range(2,isqrt(upto)+1):
%o k = 2
%o while m**k < upto:
%o A072103.append(m**k)
%o k += 1
%o print(sorted(A072103)) # _Karl-Heinz Hofmann_, Sep 16 2023
%Y Cf. A001597, A000005, A253641, A253642.
%K nonn
%O 1,1
%A _Eric W. Weisstein_, Jun 18 2002
%E Offset corrected and examples added by _M. F. Hasler_, Jan 25 2015