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-5 of 5 results.

A164147 Number of binary strings of length n with equal numbers of 0000 and 0001 substrings.

Original entry on oeis.org

1, 2, 4, 8, 14, 27, 51, 96, 183, 345, 655, 1244, 2363, 4500, 8570, 16347, 31218, 59678, 114236, 218905, 419979, 806693, 1551247, 2986469, 5756025, 11106397, 21453737, 41486062, 80309039, 155625030, 301882458, 586178231, 1139315438, 2216511306
Offset: 0

Views

Author

R. H. Hardin, Aug 11 2009

Keywords

Crossrefs

Cf. A163493 (equal 00 and 01), A164137 (equal 000 and 001), A164178 (equal 00000 and 00001).

Programs

  • Mathematica
    tup[n_] := Tuples[{0, 1}, n];
    cou[lst_List] := Count[lst, {0, 0, 0, 0}] == Count[lst, {0, 0, 0, 1}];
    par[lst_List] := Partition[lst, 4, 1];
    a[n_] := a[n] = Map[cou, Map[par, tup[n]]] // Boole // Total;
    Monitor[Table[a[n], {n, 0, 18}], {n, Table[a[m], {m, 0, n - 1}]}] (* Robert P. P. McKone, Apr 03 2024 *)

A164178 Number of binary strings of length n with equal numbers of 00000 and 00001 substrings.

Original entry on oeis.org

1, 2, 4, 8, 16, 30, 59, 115, 224, 436, 851, 1657, 3231, 6300, 12287, 23966, 46762, 91250, 178107, 347709, 678959, 1326050, 2590430, 5061449, 9891729, 19335866, 37805063, 73931821, 144613480, 282932141, 553671863, 1083726319, 2121700836, 4154763584
Offset: 0

Views

Author

R. H. Hardin, Aug 11 2009

Keywords

Crossrefs

Cf. A163493 (equal 00 and 01), A164137 (equal 000 and 001), A164147 (equal 0000 and 0001).

Programs

  • Mathematica
    tup[n_] := Tuples[{0, 1}, n];
    cou[lst_List] := Count[lst, {0, 0, 0, 0, 0}] == Count[lst, {0, 0, 0, 0, 1}];
    par[lst_List] := Partition[lst, 5, 1];
    a[n_] := a[n] = Map[cou, Map[par, tup[n]]] // Boole // Total;
    Monitor[Table[a[n], {n, 0, 18}], {n, Table[a[m], {m, 0, n - 1}]}] (* Robert P. P. McKone, Apr 03 2024 *)

A371682 Number of binary strings of length n with more 001 than 000 substrings.

Original entry on oeis.org

0, 0, 0, 1, 3, 8, 18, 41, 89, 191, 400, 833, 1717, 3523, 7184, 14604, 29588, 59822, 120695, 243166, 489271, 983530, 1975416, 3965078, 7954340, 15950301, 31972219, 64069007, 128355352, 257093509, 514864480, 1030937876, 2064045150, 4132012413, 8271156673
Offset: 0

Views

Author

Robert P. P. McKone, Apr 03 2024

Keywords

Examples

			a(5) = 8: 00100, 00101, 00110, 00111, 01001, 10010, 10011, 11001.
a(6) = 18: 001001, 001010, 001011, 001100, 001101, 001110, 001111, 010010, 010011, 011001, 100100, 100101, 100110, 100111, 101001, 110010, 110011, 111001.
		

Crossrefs

Cf. A164137 (equal 000 and 001), A371662 (more 000 than 001).

Programs

  • Mathematica
    tup[n_] := Tuples[{0, 1}, n];
    cou[lst_List] := Count[lst, {0, 0, 1}] > Count[lst, {0, 0, 0}];
    par[lst_List] := Partition[lst, 3, 1];
    a[n_] := a[n] = Map[cou, Map[par, tup[n]]] // Boole // Total;
    Monitor[Table[a[n], {n, 0, 23}], {n, Table[a[m], {m, 0, n - 1}]}]

Formula

a(n) = 2^n - A164137(n) - A371662(n).

Extensions

a(26)-a(34) from Alois P. Heinz, Apr 03 2024

A371662 Number of binary strings of length n with more 000 than 001 substrings.

Original entry on oeis.org

0, 0, 0, 1, 2, 5, 11, 26, 56, 121, 255, 539, 1123, 2332, 4808, 9891, 20262, 41413, 84411, 171760, 348857, 707593, 1433315, 2900313, 5863023, 11842460
Offset: 0

Views

Author

Robert P. P. McKone, Apr 03 2024

Keywords

Examples

			a(5) = 5: 00000, 00001, 01000, 10000, 11000.
a(6) = 11: 000000, 000001, 000010, 000011, 010000, 011000, 100000, 100001, 101000, 110000, 111000.
		

Crossrefs

Cf. A164137 (equal 000 and 001), A371682 (more 001 than 000).

Programs

  • Mathematica
    tup[n_] := Tuples[{0, 1}, n];
    cou[lst_List] := Count[lst, {0, 0, 0}] > Count[lst, {0, 0, 1}];
    par[lst_List] := Partition[lst, 3, 1];
    a[n_] := a[n] = Map[cou, Map[par, tup[n]]] // Boole // Total;
    Monitor[Table[a[n], {n, 0, 23}], {n, Table[a[m], {m, 0, n - 1}]}]

Formula

a(n) = 2^n - A164137(n) - A371682(n).

A371692 Table(n,k) of binary strings of length n which have the same number of k long 0...00 and 0...01 substrings, where n>=0 and k>=2, read by downwards antidiagonals.

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 1, 2, 4, 3, 1, 2, 4, 6, 6, 1, 2, 4, 8, 11, 9, 1, 2, 4, 8, 14, 19, 15, 1, 2, 4, 8, 16, 27, 35, 30, 1, 2, 4, 8, 16, 30, 51, 61, 54, 1, 2, 4, 8, 16, 32, 59, 96, 111, 97, 1, 2, 4, 8, 16, 32, 62, 115, 183, 200, 189, 1, 2, 4, 8, 16, 32, 64, 123
Offset: 1

Views

Author

Robert P. P. McKone, Apr 03 2024

Keywords

Comments

To clarify the substrings, k long '0...00' means k consecutive zeros, and k long '0...01' means k-1 consecutive zeros follow by a one.

Examples

			Table begins:
n\k |     2       3       4       5       6       7       8       9      10
----+----------------------------------------------------------------------
 0  |     1,      1,      1,      1,      1,      1,      1,      1,      1
 1  |     2,      2,      2,      2,      2,      2,      2,      2,      2
 2  |     2,      4,      4,      4,      4,      4,      4,      4,      4
 3  |     3,      6,      8,      8,      8,      8,      8,      8,      8
 4  |     6,     11,     14,     16,     16,     16,     16,     16,     16
 5  |     9,     19,     27,     30,     32,     32,     32,     32,     32
 6  |    15,     35,     51,     59,     62,     64,     64,     64,     64
 7  |    30,     61,     96,    115,    123,    126,    128,    128,    128
 8  |    54,    111,    183,    224,    243,    251,    254,    256,    256
 9  |    97,    200,    345,    436,    480,    499,    507,    510,    512
10  |   189,    369,    655,    851,    948,    992,   1011,   1019,   1022
11  |   360,    676,   1244,   1657,   1872,   1972,   2016,   2035,   2043
12  |   675,   1256,   2363,   3231,   3699,   3920,   4020,   4064,   4083
13  |  1304,   2337,   4500,   6300,   7305,   7792,   8016,   8116,   8160
14  |  2522,   4392,   8570,  12287,  14431,  15491,  15984,  16208,  16308
15  |  4835,   8273,  16347,  23966,  28508,  30793,  31872,  32368,  32592
16  |  9358,  15686,  31218,  46762,  56319,  61215,  63555,  64640,  65136
17  | 18193,  29837,  59678,  91250, 111266, 121692, 126729, 129088, 130176
18  | 35269,  57038, 114236, 178107, 219828, 241919, 252703, 257795, 260160
19  | 68568, 109362, 218905, 347709, 434338, 480930, 503900, 514825, 519936
		

Crossrefs

Cf. A163493 (Column 1), A164137 (Column 2), A164147 (Column 3), A164178 (Column 4).

Programs

  • Mathematica
    l0[k_] := l0[k] = ConstantArray[0, k];
    l1[k_] := l1[k] = ConstantArray[0, k - 1]~Join~{1};
    tup[n_] := Tuples[{0, 1}, n];
    cou[lst_List, k_] := Count[lst, l0[k]] == Count[lst, l1[k]];
    par[lst_List, k_] := Partition[lst, k, 1];
    a[n_, k_] := a[n, k] = Map[cou[#, k] &, Map[par[#, k] &, tup[n]]] // Boole // Total;
    (* Data *)Table[a[n, k - n], {k, 2, 13}, {n, 0, k - 2}] // Flatten
    (* Table *)Monitor[Table[a[n, k], {n, 0, 19}, {k, 2, 10}] // TableForm, {n, k}]
Showing 1-5 of 5 results.