login
Numbers having at least one anagram which is a cube.
2

%I #13 Feb 18 2024 14:25:01

%S 1,8,27,46,64,72,125,126,152,162,215,216,251,261,279,297,334,343,433,

%T 512,521,612,621,729,792,927,972,1000,1133,1269,1278,1279,1287,1296,

%U 1297,1313,1331,1349,1394,1439,1493,1629,1692,1728,1729,1782,1792,1827,1872

%N Numbers having at least one anagram which is a cube.

%C An anagram of a k-digit number is one of the k! permutations of the digits that does not begin with 0.

%H Michael S. Branicky, <a href="/A235994/b235994.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from Harvey P. Dale)

%e 126 is in the sequence because 216 = 6^3.

%t Select[Range[2000],AnyTrue[Surd[FromDigits/@Select[ Permutations[ IntegerDigits[#]],#[[1]]>0&],3],IntegerQ]&] (* The program uses the AnyTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Jul 15 2016 *)

%o (Python)

%o from itertools import count, takewhile

%o def hash(n): return "".join(sorted(str(n)))

%o def aupto_digits(d):

%o cubes = takewhile(lambda x:x<10**d, (i**3 for i in count(1)))

%o C = set(map(hash, cubes))

%o return [k for k in range(1, 10**d) if hash(k) in C]

%o print(aupto_digits(4)) # _Michael S. Branicky_, Feb 18 2024

%Y Cf. A000578, A046810, A055098, A235993.

%K nonn,base

%O 1,2

%A _Colin Barker_, Jan 19 2014