%I #31 Mar 16 2023 04:53:55
%S 2,12,112,2112,22112,122112,2122112,12122112,212122112,1212122112,
%T 11212122112,111212122112,1111212122112,11111212122112,
%U 211111212122112,1211111212122112,11211111212122112,111211111212122112,2111211111212122112,12111211111212122112
%N a(n) contains n digits (either '1' or '2') and is divisible by 2^n.
%C Corresponding quotients a(n) / 2^n are in A126933. - _Bernard Schott_, Mar 15 2023
%H Alois P. Heinz, <a href="/A053312/b053312.txt">Table of n, a(n) for n = 1..1000</a>
%F a(n) = a(n-1) + 10^(n-1)*(2-[a(n-1)/2^(n-1) mod 2]), i.e., a(n) ends with a(n-1); if the (n-1)-th term is divisible by 2^n then the n-th term begins with a 2; if not, then the n-th term begins with a 1.
%e a(5) = 22112 since 22112 = 2^5 * 691 and 22112 contains 5 digits.
%t Select[Flatten[Table[FromDigits/@Tuples[{1,2},n],{n,20}]],Divisible[ #,2^IntegerLength[#]]&] (* _Harvey P. Dale_, Jul 01 2019 *)
%o (Python)
%o from itertools import count, islice
%o def A053312_gen(): # generator of terms
%o a = 0
%o for n in count(0):
%o yield (a:=a+(10**n if (a>>n)&1 else 10**n<<1))
%o A053312_list = list(islice(A053312_gen(),20)) # _Chai Wah Wu_, Mar 15 2023
%Y Cf. A000079, A023396, A050621, A050622, A035014, A126933, A207778.
%K base,nonn
%O 1,1
%A _Henry Bottomley_, Mar 06 2000