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.

A303430 Number of binary words of length n with exactly twice as many occurrences of subword 101 as occurrences of subword 010.

Original entry on oeis.org

1, 2, 4, 6, 10, 17, 28, 49, 84, 148, 263, 472, 858, 1568, 2893, 5372, 10034, 18824, 35428, 66898, 126683, 240483, 457334, 870956, 1660850, 3171112, 6061596, 11597587, 22206775, 42551339, 81591256, 156553245, 300565760, 577360360, 1109601934, 2133499936
Offset: 0

Views

Author

Alois P. Heinz, Apr 23 2018

Keywords

Examples

			a(0) = 1: the empty word.
a(1) = 2: 0, 1.
a(2) = 4: 00, 01, 10, 11.
a(3) = 6: 000, 001, 011, 100, 110, 111.
a(4) = 10: 0000, 0001, 0011, 0110, 0111, 1000, 1001, 1100, 1110, 1111.
a(5) = 17: 00000, 00001, 00011, 00110, 00111, 01100, 01110, 01111, 10000, 10001, 10011, 10101, 11000, 11001, 11100, 11110, 11111.
		

Crossrefs

Column k=2 of A303696.

Programs

  • Maple
    b:= proc(n, t, h, c) option remember; `if`(abs(c)>2*n, 0,
         `if`(n=0, 1, b(n-1, [1, 3, 1][t], 2, c-`if`(h=3, 2, 0))
                    + b(n-1, 2, [1, 3, 1][h], c+`if`(t=3, 1, 0))))
        end:
    a:= n-> b(n, 1$2, 0):
    seq(a(n), n=0..50);