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.

A282714 Base-2 generalized Pascal triangle P_2 read by rows (see Comments for precise definition).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 2, 1, 1, 0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 3, 0, 3, 0, 0, 0, 1, 1, 1, 3, 0, 3, 0, 0, 0, 1, 1, 2, 2, 1, 1, 2, 0, 0, 0, 1, 1, 2, 3, 1, 1, 1, 1, 0, 0, 0, 1, 1, 3, 1, 3, 0, 2, 0, 1, 0, 0, 0, 1, 1, 2, 4, 1, 2, 0, 2, 0, 0
Offset: 0

Views

Author

N. J. A. Sloane, Mar 02 2017

Keywords

Comments

List the binary numbers in their natural order as binary strings, beginning with the empty string epsilon, which represents 0. Row n of the triangle gives the number of times the k-th string occurs as a (scattered) substring of the n-th string.
Row n has sum n+1.

Examples

			Triangle begins:
  1,
  1,1,
  1,1,1,
  1,2,0,1,
  1,1,2,0,1,
  1,2,1,1,0,1,
  1,2,2,1,0,0,1,
  1,3,0,3,0,0,0,1,
  1,1,3,0,3,0,0,0,1
  1,2,2,1,1,2,0,0,0,1
  1,2,3,1,1,1,1,0,0,0,1
  1,3,1,3,0,2,0,1,0,0,0,1
  1,2,4,1,2,0,2,0,0,0,0,0,1
  ...
The binary numbers are epsilon, 1, 10, 11, 100, 101, 110, 111, 1000, ...
The fifth number 101 contains
eps 1 10 11 100 101 respectively
.1..2..1..1...0...1 times, which is row 5 of the triangle.
		

Crossrefs

A007306 gives (essentially) the number of nonzero entries in the rows.

Programs

  • Maple
    Nscatsub := proc(subw,w)
        local lsubw,lw,N,wri,wr,i ;
        lsubw := nops(subw) ;
        lw := nops(w) ;
        N := 0 ;
        if lsubw = 0 then
            return 1 ;
        elif lsubw > lw then
            return 0 ;
        else
            for wri in combinat[choose](lw,lsubw) do
                wr := [] ;
                for i in wri do
                    wr := [op(wr),op(i,w)] ;
                end do:
                if verify(subw,wr,'sublist') then
                    N := N+1 ;
                end if;
            end do:
        end if;
        return N ;
    end proc:
    P := proc(n,k,b)
        local n3,k3 ;
        n3 := convert(n,base,b) ;
        k3 := convert(k,base,b) ;
        Nscatsub(k3,n3) ;
    end proc:
    A282714 := proc(n,k)
        P(n,k,2) ;
    end proc: # R. J. Mathar, Mar 03 2017
  • Mathematica
    nmax = 12;
    row[n_] := Module[{bb, ss}, bb = Table[IntegerDigits[k, 2], {k, 0, n}]; ss = Subsets[Last[bb]]; Prepend[Count[ss, #]& /@ bb // Rest, 1]];
    Table[row[n], {n, 0, nmax}] // Flatten (* Jean-François Alcover, Dec 14 2017 *)

Extensions

More terms from Lars Blomberg, Mar 03 2017