OFFSET
1,1
COMMENTS
There are exactly 22 solutions in base 10.
More precisely: the concatenation of n and n^2 does not contain any digit twice. - M. F. Hasler, Oct 16 2018
a(20) = 567 and a(22) = 854 are the only two numbers k such that k and k^2 combined use each of the digits 1 to 9 exactly once (reference David Wells): 567^2 = 321489 and 854^2 = 729316. - Bernard Schott, Mar 23 2021
REFERENCES
M. Kraitchik, Mathematical Recreations, p. 48, Problem 12. - From N. J. A. Sloane, Mar 15 2013
David Wells, The Penguin Dictionary of Curious and Interesting Numbers, Revised Edition, 1997, page 144, entry 567.
MAPLE
M:=1000;
a1:=[]; a2:=[];
for n from 1 to M do
# are digits of n and n^2 distinct?
t1:=convert(n, base, 10);
t2:=convert(n^2, base, 10);
s3:={op(t1), op(t2)};
if nops(t1)+nops(t2) = nops(s3) then a1:=[op(a1), n]; a2:=[op(a2), n^2]; fi;
od:
a1; a2;
# N. J. A. Sloane, Mar 15 2013
MATHEMATICA
Select[Range[10000], Intersection[IntegerDigits[ # ], IntegerDigits[ #^2]] == {} && Length[Union[IntegerDigits[ # ], IntegerDigits[ #^2]]] == Length[IntegerDigits[ # ]] + Length[IntegerDigits[ #^2]] &] (* Tanya Khovanova, Dec 25 2006 *)
Select[Range[10^3], Union@ Tally[Flatten@ IntegerDigits@ {#, #^2}][[All, -1]] == {1} &] (* Michael De Vlieger, Oct 17 2018 *)
PROG
(PARI) select( is(n)=#Set(Vecsmall(n=Str(n, n^2)))==#n, [1..999]) \\ M. F. Hasler, Oct 16 2018
CROSSREFS
KEYWORD
nonn,base,fini,full
AUTHOR
Patrick De Geest, Feb 15 2001
STATUS
approved