login
Zeroless numbers n such that n and n^2 have the same set of decimal digits.
5

%I #19 May 31 2015 17:18:38

%S 1,4762,4832,12385,14829,26394,34196,36215,49827,68474,72576,74528,

%T 79286,79836,94583,94867,96123,98376,123385,123546,124235,124365,

%U 124579,124589,125476,125478,126969,129685,135438,139256,139261,139756,149382,152385,156242

%N Zeroless numbers n such that n and n^2 have the same set of decimal digits.

%H Alois P. Heinz, <a href="/A257763/b257763.txt">Table of n, a(n) for n = 1..10000</a>

%F {A029793} intersect {A052382}.

%e 4762 is in the sequence because it is zeroless and 4762^2 = 22676644 has the same set of decimal digits as 4762: {2,4,6,7}.

%p a:= proc(n) option remember; local k, s;

%p for k from 1+`if`(n=1, 0, a(n-1)) do

%p s:= {convert(k, base, 10)[]};

%p if not 0 in s and s={convert(k^2, base, 10)[]}

%p then return k fi

%p od

%p end:

%p seq(a(n), n=1..10);

%t sameQ[n_]:=Union[IntegerDigits[n]]==Union[IntegerDigits[n^2]];Select[Range@156242,And[FreeQ[IntegerDigits[#],0],sameQ[#]]&] (* _Ivan N. Ianakiev_, May 08 2015 *)

%o (Python)

%o A257763_list = [n for n in range(1,10**6) if not '0' in str(n) and set(str(n)) == set(str(n**2))] # _Chai Wah Wu_, May 31 2015

%o (PARI) isok(n) = vecmin(d=digits(n)) && Set(d) == Set(digits(n^2)); \\ _Michel Marcus_, May 31 2015

%Y Cf. A029793, A052382, A257760.

%K nonn,base

%O 1,2

%A _Alois P. Heinz_, May 07 2015