login
Numbers k such that digits of k^2 include digits of k as subsequence.
7

%I #16 Dec 29 2023 05:00:36

%S 0,1,5,6,10,11,25,50,60,76,95,96,100,101,105,110,125,205,250,305,371,

%T 376,405,441,500,501,505,506,525,600,601,605,625,676,705,756,760,805,

%U 825,826,905,946,950,960,976,995,996,1000,1001,1005,1006,1010,1011

%N Numbers k such that digits of k^2 include digits of k as subsequence.

%t fQ[n_]:=LongestCommonSequence[ToString[n^2],ToString[n]]==ToString[n];

%t Select[Range[0,1011],fQ[#]&] (* _Ivan N. Ianakiev_, Dec 29 2023 *)

%o (Python)

%o from itertools import count, islice

%o def A046829_gen(startvalue=0): # generator of terms >= startvalue

%o for k in count(max(startvalue,0)):

%o c = iter(str(k**2))

%o if all(map(lambda b:any(map(lambda a:a==b,c)),str(k))):

%o yield k

%o A046829_list = list(islice(A046829_gen(),20)) # _Chai Wah Wu_, Apr 03 2023

%Y Cf. A046827, A062118 (subsequence).

%K nonn,base

%O 1,3

%A _David W. Wilson_

%E Offset 1 from _Alois P. Heinz_, Apr 03 2023