This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A053312 #39 Feb 10 2025 17:39:11 %S A053312 2,12,112,2112,22112,122112,2122112,12122112,212122112,1212122112, %T A053312 11212122112,111212122112,1111212122112,11111212122112, %U A053312 211111212122112,1211111212122112,11211111212122112,111211111212122112,2111211111212122112,12111211111212122112 %N A053312 a(n) contains n digits (either '1' or '2') and is divisible by 2^n. %C A053312 Corresponding quotients a(n) / 2^n are in A126933. - _Bernard Schott_, Mar 15 2023 %H A053312 Alois P. Heinz, <a href="/A053312/b053312.txt">Table of n, a(n) for n = 1..1000</a> %F A053312 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 A053312 a(5) = 22112 since 22112 = 2^5 * 691 and 22112 contains 5 digits. %p A053312 a:= proc(n) option remember; `if`(n=1, 2, (t-> parse( %p A053312 cat(`if`(irem(t, 2^n)=0, 2, 1), t)))(a(n-1))) %p A053312 end: %p A053312 seq(a(n), n=1..20); # _Alois P. Heinz_, Feb 02 2025 %t A053312 Select[Flatten[Table[FromDigits/@Tuples[{1,2},n],{n,20}]],Divisible[ #,2^IntegerLength[#]]&] (* _Harvey P. Dale_, Jul 01 2019 *) %t A053312 RecurrenceTable[{a[1]==2, a[n]==a[n-1]+10^(n-1)(2-Mod[a[n-1]/2^(n-1),2])}, a[n], {n, 1, 20}] (* _Paul C Abbott_, Feb 03 2025 *) %o A053312 (Python) %o A053312 from itertools import count, islice %o A053312 def A053312_gen(): # generator of terms %o A053312 a = 0 %o A053312 for n in count(0): %o A053312 yield (a:=a+(10**n if (a>>n)&1 else 10**n<<1)) %o A053312 A053312_list = list(islice(A053312_gen(),20)) # _Chai Wah Wu_, Mar 15 2023 %Y A053312 Cf. A000079, A023396, A050621, A050622, A035014, A126933, A207778. %K A053312 base,nonn %O A053312 1,1 %A A053312 _Henry Bottomley_, Mar 06 2000