OFFSET
1,2
COMMENTS
An anagram of x is a number whose base-10 representation is a permutation of that of x, where leading zeros are not allowed (except for x = 0).
All terms are divisible by 3.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(6) = 240 is a term because 240^2 = 156^2 + 33264, where 33264 is an anagram of 156^2 = 24336.
The first term with more than one such representation is a(7) = 264, where 264^2 = 198^2 + 30492 = 231^2 + 16335, where 30492 is an anagram of 198^2 = 39204 and 16335 is an anagram of 231^2 = 53361.
MAPLE
g:= proc(n) local d, L, i;
L:= convert(n, base, 10); d:= nops(L);
select(issqr, convert(map(t -> n + add(t[i]*10^(i-1), i=1..d), select( t -> t[-1] <> 0, combinat:-permute(L))), set))
end proc:
A:=map(sqrt, select(`<=`, `union`({0}, op(map(g, {seq(i^2, i=1..2000)}))), 4*10^6)):
sort(convert(A, list));
MATHEMATICA
ClearAll[permNumber, g, Q, U, U2, A];
permNumber[n_]:=Module[{d=Reverse[IntegerDigits[n]]}, FromDigits[Reverse[#]]&/@Select[Permutations[d], Last[#]!=0&]];
g[n_]:=Select[n+permNumber[n], IntegerQ[Sqrt[#]]&];
Q=Table[k^2, {k, 1, 2000}];
U=Union[Join[Flatten[g/@Q], {0}]];
U2=Select[U, #<=4*10^6&];
A=Sort[Sqrt/@U2];
A (* Vincenzo Librandi, Mar 12 2026, after Maple. *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert Israel, Mar 05 2026
STATUS
approved
