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

A303696 Number A(n,k) of binary words of length n with k times as many occurrences of subword 101 as occurrences of subword 010; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 2, 1, 2, 4, 1, 2, 4, 7, 1, 2, 4, 6, 12, 1, 2, 4, 6, 12, 21, 1, 2, 4, 6, 10, 20, 37, 1, 2, 4, 6, 10, 17, 38, 65, 1, 2, 4, 6, 10, 16, 28, 66, 114, 1, 2, 4, 6, 10, 16, 26, 49, 124, 200, 1, 2, 4, 6, 10, 16, 26, 42, 84, 224, 351, 1, 2, 4, 6, 10, 16, 26, 42, 70, 148, 424, 616
Offset: 0

Views

Author

Alois P. Heinz, Apr 28 2018

Keywords

Comments

A(n,n) is the number of binary words of length n avoiding both subwords 101 and 010. A(4,4) = 10: 0000, 0001, 0011, 0110, 0111, 1000, 1001, 1100, 1110, 1111.

Examples

			Square array A(n,k) begins:
    1,   1,   1,   1,   1,   1,   1, ...
    2,   2,   2,   2,   2,   2,   2, ...
    4,   4,   4,   4,   4,   4,   4, ...
    7,   6,   6,   6,   6,   6,   6, ...
   12,  12,  10,  10,  10,  10,  10, ...
   21,  20,  17,  16,  16,  16,  16, ...
   37,  38,  28,  26,  26,  26,  26, ...
   65,  66,  49,  42,  42,  42,  42, ...
  114, 124,  84,  70,  68,  68,  68, ...
  200, 224, 148, 116, 110, 110, 110, ...
  351, 424, 263, 196, 178, 178, 178, ...
		

Crossrefs

Columns k=0-3 give: A005251(n+3), A164146, A303430, A307795.
Main diagonal gives A128588(n+1).

Programs

  • Maple
    b:= proc(n, t, h, c, k) option remember; `if`(abs(c)>k*n, 0,
         `if`(n=0, 1, b(n-1, [1, 3, 1][t], 2, c-`if`(h=3, k, 0), k)
                    + b(n-1, 2, [1, 3, 1][h], c+`if`(t=3, 1, 0), k)))
        end:
    A:= (n, k)-> b(n, 1$2, 0, min(k, n)):
    seq(seq(A(n, d-n), n=0..d), d=0..14);
  • Mathematica
    b[n_, t_, h_, c_, k_] := b[n, t, h, c, k] = If[Abs[c] > k n, 0, If[n == 0, 1, b[n - 1, {1, 3, 1}[[t]], 2, c - If[h == 3, k, 0], k] + b[n - 1, 2, {1, 3, 1}[[h]], c + If[t == 3, 1, 0], k]]];
    A[n_, k_] := b[n, 1, 1, 0, Min[k, n]];
    Table[Table[A[n, d - n], {n, 0, d}], {d, 0, 14}] // Flatten (* Jean-François Alcover, Mar 20 2020, from Maple *)

Formula

ceiling(A(n,n)/2) = A000045(n+1).

A164146 Number of binary strings of length n with equal numbers of 010 and 101 substrings.

Original entry on oeis.org

1, 2, 4, 6, 12, 20, 38, 66, 124, 224, 424, 788, 1502, 2838, 5438, 10386, 20004, 38508, 74516, 144264, 280216, 544736, 1061292, 2069596, 4042254, 7902294, 15466842, 30297422, 59404174, 116558270, 228876426, 449713994, 884199348, 1739434972, 3423770240, 6742430340
Offset: 0

Views

Author

R. H. Hardin, Aug 11 2009

Keywords

Examples

			a(5) = 20: 00000, 00001, 00011, 00101, 00110, 00111, 01011, 01100, 01110, 01111, 10000, 10001, 10011, 10100, 11000, 11001, 11010, 11100, 11110, 11111. - _Alois P. Heinz_, Apr 16 2015
		

Crossrefs

Column k=1 of A303696.
Column k=0 of A307796.

Programs

  • Mathematica
    CoefficientList[Series[-(4*x^4-2*x^3-2*x^2+x+Sqrt[(2*x-1)*(2*x^2-1)*(2*x^2-2*x+1)]) / ((x-1)*(2*x-1)*(2*x^2-1)),{x,0,33}],x] (* Stefano Spezia, Jul 31 2025 *)

Formula

G.f.: -(4*x^4-2*x^3-2*x^2+x+sqrt((2*x-1)*(2*x^2-1)*(2*x^2-2*x+1))) / ((x-1)*(2*x-1)*(2*x^2-1)). - Alois P. Heinz, Apr 16 2015

A284449 Number of n X 1 0..1 arrays with the number of 1's king-move adjacent to some 0 one less than the number of 0's adjacent to some 1.

Original entry on oeis.org

0, 0, 0, 1, 2, 6, 12, 28, 56, 119, 236, 481, 950, 1902, 3752, 7450, 14684, 29032, 57192, 112850, 222308, 438359, 863808, 1703239, 3357766, 6622471, 13061980, 25772503, 50859826, 100399602, 198235896, 391523612, 773453896, 1528361734, 3020781528, 5971996960
Offset: 0

Views

Author

R. H. Hardin, Mar 27 2017

Keywords

Comments

Number of binary words of length n with exactly one occurrence of subword 101 more than occurrences of subword 010. a(5) = 6: 01101, 10101, 10110, 10111, 11011, 11101. - Alois P. Heinz, Apr 23 2018

Examples

			Both solutions for n=4
..0. .0
..1. .0
..0. .1
..0. .0
		

Crossrefs

Column 1 of A284455 and of A307796.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<6, [0$3, 1, 2, 6][n+1],
          ((n+2)*(5*n^4-98*n^3+661*n^2-1680*n+1164) *a(n-1)
           -4*(2*n^5-37*n^4+226*n^3-442*n^2-87*n+204) *a(n-2)
           -2*(3*n^4-63*n^3+376*n^2-468*n+264) *a(n-3)
           +2*(8*n^5-155*n^4+1060*n^3-3035*n^2+3738*n-1752) *a(n-4)
           -4*(5*n^5-101*n^4+750*n^3-2450*n^2+3312*n-1248) *a(n-5)
           +4*(2*n-9)*(n^4-16*n^3+85*n^2-150*n+48) *a(n-6)) /
           ((n+3)*(n^4-20*n^3+139*n^2-372*n+300)))
        end:
    seq(a(n), n=0..35);  # Alois P. Heinz, Apr 23 2018

Formula

Recursion: see Maple program. - Alois P. Heinz, Apr 23 2018

A286209 Number of n X 1 0..1 arrays with the number of 1's king-move adjacent to some 0 two less than the number of 0's adjacent to some 1.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 3, 10, 24, 60, 134, 304, 656, 1420, 2996, 6312, 13112, 27167, 55825, 114412, 233282, 474563, 962159, 1947098, 3931288, 7925708, 15952866, 32072580, 64404708, 129213082, 259009006, 518818124, 1038549912, 2077775396, 4154785904, 8304424080
Offset: 0

Views

Author

R. H. Hardin, May 04 2017

Keywords

Examples

			All solutions for n=7
..0. .0. .0
..1. .0. .1
..0. .1. .0
..0. .0. .0
..0. .0. .1
..1. .1. .0
..0. .0. .0
		

Crossrefs

Column k=1 of A286216.
Column k=2 of A307796.

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, 1, 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..40);  # Alois P. Heinz, Apr 29 2019
  • Mathematica
    b[n_, t_, h_, c_] := b[n, t, h, c] = If[Abs[c - 2] > n, 0, If[n == 0, 1,
         b[n - 1, {1, 3, 1}[[t]], 2, c - If[h == 3, 1, 0]] +
         b[n - 1, 2, {1, 3, 1}[[h]], c + If[t == 3, 1, 0]]]];
    a[n_] := b[n, 1, 1, 0];
    Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Jun 27 2022, after Alois P. Heinz *)
Showing 1-4 of 4 results.