login
Numbers k such that k and k^2 use only the digits 1, 6, 7 and 8.
0

%I #15 May 10 2024 10:59:35

%S 1,881,88776,7866881

%N Numbers k such that k and k^2 use only the digits 1, 6, 7 and 8.

%C Generated with DrScheme.

%C No additional terms through 10^10. - _Harvey P. Dale_, Apr 26 2015

%C No additional terms through 10^27. - _Robert Israel_, Nov 23 2023

%H Jonathan Wellons, <a href="https://web.archive.org/web/20090206165028/http://jonathanwellons.com/shared-digits/">Tables of Shared Digits</a> [archived]

%e 7866881^2 = 61887816668161.

%p Good:= {1,6,7,8}:

%p G[1]:= {1,6}: R:= 1;

%p for d from 2 to 27 do

%p G[d]:= select(t -> member(floor((t^2 mod 10^d)/10^(d-1)),Good), map(t -> seq(10^(d-1)*i+t, i=Good), G[d-1]));

%p for t in G[d] do

%p if convert(convert(t^2,base,10),set) subset Good then R:= R,t fi

%p od

%p od:

%p sort([R]); # _Robert Israel_, Nov 23 2023

%t With[{c={1,6,7,8}},Select[Flatten[Table[FromDigits/@Tuples[c,n],{n,7}]],SubsetQ[c,IntegerDigits[#^2]]&]] (* _Harvey P. Dale_, Apr 26 2015 *)

%K base,nonn,more

%O 1,2

%A Jonathan Wellons (wellons(AT)gmail.com), Jan 22 2008