%I #21 Sep 08 2022 08:45:32
%S 5,25,2585,828665,25662585
%N Numbers k such that k and k^2 use only the digits 2, 5, 6 and 8.
%C Generated with DrScheme.
%C No further terms < 2*10^22. - _Robert Israel_, Oct 04 2019
%C No further terms < 10^29. - _David A. Corneth_, Oct 04 2019
%H J. Wellons, <a href="https://web.archive.org/web/20090206165028/http://jonathanwellons.com/shared-digits/">Tables of Shared Digits</a> [Wayback Machine link added by _Felix Fröhlich_, Oct 04 2019]
%e 25662585^2 = 658568268882225.
%p Extend:= proc(x,d)
%p local i;
%p op(select(t -> member(floor(t^2/10^(d)) mod 10, {2,5,6,8}), [seq(i*10^d+x,i=[2,5,6,8])]))
%p end proc:
%p R[0]:= [5,6]:
%p for m from 1 to 10 do R[m]:= map(Extend,R[m-1],m) od:
%p [seq(op(select(t -> convert(convert(t^2,base,10),set) subset {2,5,6,8}, R[m])),m=0..10)];# _Robert Israel_, Oct 04 2019
%t With[{c={2,5,6,8}},Select[FromDigits/@Flatten[Table[Tuples[c,n],{n,8}],1],SubsetQ[ c,IntegerDigits[#^2]]&]] (* _Harvey P. Dale_, Jan 25 2021 *)
%o (Magma) [k:k in [1..10^6]| Set(Intseq(k)) join Set(Intseq(k^2)) subset {2,5,6,8}]; // _Marius A. Burtea_, Oct 04 2019
%o (PARI) is(n) = my(v=[0, 1, 3, 4, 7, 9]); #setintersect(vecsort(digits(n), , 8), v)==0 && #setintersect(vecsort(digits(n^2), , 8), v)==0 \\ _Felix Fröhlich_, Oct 04 2019
%K nonn,base,more
%O 1,1
%A Jonathan Wellons (wellons(AT)gmail.com), Jan 22 2008
|