OFFSET
1,2
COMMENTS
13689 is a term because it is a square (117^2) and 19683 (an anagram of 13689) is a cube (27^3).
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..388 from Harvey P. Dale)
MATHEMATICA
sacQ[n_]:=Module[{len=IntegerLength[n], trms=FromDigits/@Permutations[ IntegerDigits[ n]]}, trms=Select[ trms, IntegerLength[#]==len&]; AnyTrue[ trms, IntegerQ[Surd[#, 3]]&]]; Select[Range[900]^2, sacQ] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 03 2019 *)
PROG
(Python)
from itertools import count, takewhile
def hash(n): return "".join(sorted(str(n)))
def aupto_digits(d):
cubes = takewhile(lambda x:x<10**d, (i**3 for i in count(1)))
squares = takewhile(lambda x:x<10**d, (i**2 for i in count(1)))
C = set(map(hash, cubes))
return [s for s in squares if hash(s) in C]
print(aupto_digits(6)) # Michael S. Branicky, Feb 18 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Claudio Meller, Jun 20 2009
STATUS
approved