|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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]
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|