login
A161860
Squares which are anagrams of cubes.
1
1, 64, 729, 1296, 2916, 4096, 7921, 9216, 9604, 13689, 15129, 15625, 25921, 46656, 66564, 117649, 119025, 125316, 147456, 159201, 237169, 257049, 260100, 262144, 292681, 300304, 338724, 447561, 497025, 531441, 546121, 611524, 687241, 725904
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
Cf. A000290 (squares), A000578 (cubes).
Sequence in context: A164337 A354178 A367803 * A195249 A223953 A224137
KEYWORD
nonn,base
AUTHOR
Claudio Meller, Jun 20 2009
STATUS
approved