cp's OEIS Frontend

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.

Showing 1-3 of 3 results.

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.

Original entry on oeis.org

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, 18, 667, 278, 68, 10, 1, 1178, 722, 142, 6, 2031, 1827, 237, 1, 4105, 3140, 862, 84, 1, 6872, 7800, 1672, 40, 20569, 5810, 3188, 1662, 829, 394, 181, 80, 35, 12, 5, 2, 1
Offset: 0

Views

Author

Alois P. Heinz, Dec 18 2013

Keywords

Comments

T(n,k) is defined for n,k >= 0. The triangle contains only the positive terms.

Examples

			T(3,0) = 5: 000, 001, 010, 100, 101 (subword 11 is avoided).
T(3,1) = 2: 011, 110 (exactly one occurrence of 11).
T(3,2) = 1: 111 (two overlapping occurrences of 11).
Triangle T(n,k) begins:
: n\k :   0    1   2   3  4  5 ...
+-----+------------------------
:  0  :   1;                       [row  0 of A007318]
:  1  :   1,   1;                  [row  1 of A007318]
:  2  :   3,   1;                  [row  2 of A034867]
:  3  :   5,   2,  1;              [row  3 of A076791]
:  4  :  12,   4;                  [row  4 of A118424]
:  5  :  21,  10,  1;              [row  5 of A118429]
:  6  :  33,  30,  1;              [row  6 of A118424]
:  7  :  81,  26, 13,  5, 2, 1;    [row  7 of A118390]
:  8  : 177,  78,  1;              [row  8 of A118884]
:  9  : 338, 156, 18;              [row  9 of A118890]
: 10  : 667, 278, 68, 10, 1;       [row 10 of A118869]
		

Crossrefs

Columns k=0-10 give: A234005 (or main diagonal of A209972), A229905, A236231, A236232, A236233, A236234, A236235, A236236, A236237, A236238, A236239.
T(2^n-1,2^n-2n+1) = A045623(n-1) for n>0.
Last elements of rows give A229293.
Row sums give A000079.

Programs

  • Maple
    F:= proc(n)
    local w, L, s,b,s0,R,j,T,p,y,m,ymax;
    w:= ListTools:-Reverse(convert(n,base,2));
    L:= nops(w);
    for s from 0 to L-1 do
      for b from 0 to 1 do
       s0:= [op(w[1..s]),b];
       if s0 = w then R[s,b]:= 1
       else R[s,b]:= 0
       fi;
       for j from min(nops(s0),L-1) by -1 to 0 do
          if s0[-j..-1] = w[1..j] then
            T[s,b]:= j;
            break
          fi
       od;
    od;
    od;
    for s from L-1 by -1 to 0 do
      p[0,s,n]:= 1:
      for y from 1 to n do
         p[y,s,n]:= 0 od od;
    for m from n-1 by -1 to 0 do
       for s from L-1 by -1 to 0 do
          for y from 0 to n do
            p[y,s,m]:= `if`(y>=R[s,0],1/2*p[y-R[s,0],T[s,0],m+1],0)
                      +
    `if`(y>=R[s,1],1/2*p[y-R[s,1],T[s,1],m+1],0)
    od od od:
    ymax:= ListTools:-Search(0,[seq(p[y,0,0],y=0..n)])-2;
    seq(2^n*p[y,0,0],y=0..ymax);
    end proc:
    F(0):= 1:
    F(1):= (1,1):
    for n from 0 to 30 do F(n) od; # Robert Israel, May 22 2015
  • Mathematica
    (* 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 *)

Formula

Sum_{k>0} k*T(n,k) = A228612(n).

A118430 Number of binary sequences of length n containing exactly one subsequence 010.

Original entry on oeis.org

0, 0, 0, 1, 4, 10, 22, 47, 98, 199, 396, 777, 1508, 2900, 5534, 10492, 19782, 37119, 69358, 129118, 239578, 443229, 817822, 1505389, 2764986, 5068435, 9273928, 16940488, 30897020, 56271128, 102347564, 185922589, 337353688, 611462514
Offset: 0

Views

Author

Emeric Deutsch, Apr 27 2006

Keywords

Comments

With only two 0's at the beginning, the convolution of A005314 with itself. Column 1 of A118429.

Examples

			a(4) = 4 because we have 0100, 0101, 0010 and 1010.
		

Crossrefs

Programs

  • Maple
    g:=z^3/(1-2*z+z^2-z^3)^2: gser:=series(g,z=0,40): seq(coeff(gser,z,n),n=0..38);
  • Mathematica
    LinearRecurrence[{4, -6, 6, -5, 2, -1}, {0, 0, 0, 1, 4, 10}, 40] (* Jean-François Alcover, May 11 2019 *)

Formula

G.f.: z^3/(1-2*z+z^2-z^3)^2.

A118869 Triangle read by rows: T(n,k) is the number of binary sequences of length n containing k subsequences 0101 (n,k>=0).

Original entry on oeis.org

1, 2, 4, 8, 15, 1, 28, 4, 53, 10, 1, 100, 24, 4, 188, 57, 10, 1, 354, 128, 26, 4, 667, 278, 68, 10, 1, 1256, 596, 164, 28, 4, 2365, 1260, 381, 79, 10, 1, 4454, 2628, 876, 200, 30, 4, 8388, 5430, 1977, 488, 90, 10, 1, 15796, 11136, 4380, 1184, 236, 32, 4, 29747, 22683
Offset: 0

Views

Author

Emeric Deutsch, May 03 2006

Keywords

Comments

Row n has floor(n/2) terms (n>=2). Sum of entries in row n is 2^n (A000079). T(n,0) = A118870(n). T(n,1) = A118871(n). Sum(k*T(n,k), k=0..n-1) = (n-3)*2^(n-4) (A001787).

Examples

			T(7,2) = 4 because we have 0101010, 0101011, 0010101 and 1010101.
Triangle starts:
   1;
   2;
   4;
   8;
  15,  1;
  28,  4;
  53, 10, 1;
  ...
		

Crossrefs

Programs

  • Maple
    G:=(1+(1-t)*z^2)/(1-2*z+(1-t)*z^2*(1-z)^2): Gser:=simplify(series(G,z=0,20)): P[0]:=1: for n from 1 to 16 do P[n]:=coeff(Gser,z^n) od: 1;2;for n from 1 to 16 do seq(coeff(P[n],t,j),j=0..floor(n/2)-1) od; # yields sequence in triangular form
    # second Maple program:
    b:= proc(n, t) option remember; `if`(n=0, 1,
           expand(b(n-1, `if`(t=3, 4, 2))+
           b(n-1, 3-2*irem(t, 2))*`if`(t=4, x, 1)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 1)):
    seq(T(n), n=0..16); # Alois P. Heinz, Nov 28 2013
  • Mathematica
    nn=15;CoefficientList[Series[1/(1-2z-(u-1)z^4/(1-(u-1)z^2)),{z,0,nn}],{z,u}]//Grid (* Geoffrey Critzer, Nov 29 2013 *)

Formula

G.f.: G(t,z) = [1+(1-t)z^2]/[1-2z+(1-t)z^2*(1-z)^2].
Showing 1-3 of 3 results.