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 A233940 #45 Aug 05 2018 22:03:48 %S A233940 1,1,1,3,1,5,2,1,12,4,21,10,1,33,30,1,81,26,13,5,2,1,177,78,1,338,156, %T A233940 18,667,278,68,10,1,1178,722,142,6,2031,1827,237,1,4105,3140,862,84,1, %U A233940 6872,7800,1672,40,20569,5810,3188,1662,829,394,181,80,35,12,5,2,1 %N A233940 Number T(n,k) of binary words of length n with exactly k (possibly overlapping) occurrences of the subword given by the binary expansion of n; triangle T(n,k), n>=0, read by rows. %C A233940 T(n,k) is defined for n,k >= 0. The triangle contains only the positive terms. %H A233940 Alois P. Heinz, <a href="/A233940/b233940.txt">Rows n = 0..500, flattened</a> %F A233940 Sum_{k>0} k*T(n,k) = A228612(n). %e A233940 T(3,0) = 5: 000, 001, 010, 100, 101 (subword 11 is avoided). %e A233940 T(3,1) = 2: 011, 110 (exactly one occurrence of 11). %e A233940 T(3,2) = 1: 111 (two overlapping occurrences of 11). %e A233940 Triangle T(n,k) begins: %e A233940 : n\k : 0 1 2 3 4 5 ... %e A233940 +-----+------------------------ %e A233940 : 0 : 1; [row 0 of A007318] %e A233940 : 1 : 1, 1; [row 1 of A007318] %e A233940 : 2 : 3, 1; [row 2 of A034867] %e A233940 : 3 : 5, 2, 1; [row 3 of A076791] %e A233940 : 4 : 12, 4; [row 4 of A118424] %e A233940 : 5 : 21, 10, 1; [row 5 of A118429] %e A233940 : 6 : 33, 30, 1; [row 6 of A118424] %e A233940 : 7 : 81, 26, 13, 5, 2, 1; [row 7 of A118390] %e A233940 : 8 : 177, 78, 1; [row 8 of A118884] %e A233940 : 9 : 338, 156, 18; [row 9 of A118890] %e A233940 : 10 : 667, 278, 68, 10, 1; [row 10 of A118869] %p A233940 F:= proc(n) %p A233940 local w, L, s,b,s0,R,j,T,p,y,m,ymax; %p A233940 w:= ListTools:-Reverse(convert(n,base,2)); %p A233940 L:= nops(w); %p A233940 for s from 0 to L-1 do %p A233940 for b from 0 to 1 do %p A233940 s0:= [op(w[1..s]),b]; %p A233940 if s0 = w then R[s,b]:= 1 %p A233940 else R[s,b]:= 0 %p A233940 fi; %p A233940 for j from min(nops(s0),L-1) by -1 to 0 do %p A233940 if s0[-j..-1] = w[1..j] then %p A233940 T[s,b]:= j; %p A233940 break %p A233940 fi %p A233940 od; %p A233940 od; %p A233940 od; %p A233940 for s from L-1 by -1 to 0 do %p A233940 p[0,s,n]:= 1: %p A233940 for y from 1 to n do %p A233940 p[y,s,n]:= 0 od od; %p A233940 for m from n-1 by -1 to 0 do %p A233940 for s from L-1 by -1 to 0 do %p A233940 for y from 0 to n do %p A233940 p[y,s,m]:= `if`(y>=R[s,0],1/2*p[y-R[s,0],T[s,0],m+1],0) %p A233940 + %p A233940 `if`(y>=R[s,1],1/2*p[y-R[s,1],T[s,1],m+1],0) %p A233940 od od od: %p A233940 ymax:= ListTools:-Search(0,[seq(p[y,0,0],y=0..n)])-2; %p A233940 seq(2^n*p[y,0,0],y=0..ymax); %p A233940 end proc: %p A233940 F(0):= 1: %p A233940 F(1):= (1,1): %p A233940 for n from 0 to 30 do F(n) od; # _Robert Israel_, May 22 2015 %t A233940 (* This program is not convenient for a large number of rows *) count[word_List, subword_List] := Module[{cnt = 0, s1 = Sequence @@ subword, s2 = Sequence @@ Rest[subword]}, word //. {a___, s1, b___} :> (cnt++; {a, 2, s2, b}); cnt]; t[n_, k_] := Module[{subword, words}, subword = IntegerDigits[n, 2]; words = PadLeft[IntegerDigits[#, 2], n] & /@ Range[0, 2^n - 1]; Select[words, count[#, subword] == k &] // Length]; row[n_] := Reap[For[k = 0, True, k++, tnk = t[n, k]; If[tnk == 0, Break[], Sow[tnk]]]][[2, 1]]; Table[Print["n = ", n, " ", r = row[n]]; r, {n, 0, 15}] // Flatten (* _Jean-François Alcover_, Feb 13 2014 *) %Y A233940 Columns k=0-10 give: A234005 (or main diagonal of A209972), A229905, A236231, A236232, A236233, A236234, A236235, A236236, A236237, A236238, A236239. %Y A233940 T(2^n-1,2^n-2n+1) = A045623(n-1) for n>0. %Y A233940 Last elements of rows give A229293. %Y A233940 Row sums give A000079. %K A233940 nonn,look,tabf,nice %O A233940 0,4 %A A233940 _Alois P. Heinz_, Dec 18 2013