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.

Previous Showing 11-15 of 15 results.

A151975 The number of ways one can flip seven consecutive tails (or heads) when flipping a coin n times.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 3, 8, 20, 48, 112, 256, 576, 1279, 2811, 6126, 13256, 28512, 61008, 129952, 275712, 582913, 1228551, 2582048, 5412984, 11321744, 23631056, 49229312, 102377216, 212560127, 440668919, 912310222, 1886316324, 3895528632, 8035861664
Offset: 0

Views

Author

Benjamin Merkel, Aug 05 2012

Keywords

Comments

a(n-1) is the number of compositions of n with at least one part >=8. - Joerg Arndt, Aug 06 2012

Examples

			a(0)=0 means that there are no cases of seven consecutive tails (or heads) in zero coin flips.  Likewise, a(1)=a(2)=...=a(6)=0.  a(7)=1 since there is exactly one case of seven consecutive tails in seven coin flips.
		

Crossrefs

Programs

  • PARI
    N=66;  x='x+O('x^N);
    gf = (1-x)/(1-2*x); /* A011782(n): compositions of n */
    gf -= 1/(1 - (x+x^2+x^3+x^4+x^5+x^6+x^7)); /* A066178(n): compositions of n into parts <=7 */
    v151975=Vec(gf + 'a0);  v151975[1]=0; /* kludge to get all terms */
    v151975 /* show terms */
    /* Joerg Arndt, Aug 06 2012 */
    
  • PARI
    concat(vector(7), Vec(x^7/((2*x-1)*(x^7+x^6+x^5+x^4+x^3+x^2+x-1)) + O(x^100))) \\ Colin Barker, Oct 16 2015

Formula

a(n) = A000079(n) - A066178(n+1).
G.f.: x^7 / ((2*x-1)*(x^7+x^6+x^5+x^4+x^3+x^2+x-1)). - Colin Barker, Oct 16 2015

A341050 Cube array read by upward antidiagonals ignoring zero and empty terms: T(n, k, r) is the number of n-ary strings of length k, containing r consecutive 0's.

Original entry on oeis.org

1, 1, 1, 3, 1, 1, 3, 1, 5, 8, 1, 1, 3, 1, 5, 8, 1, 7, 21, 19, 1, 1, 3, 1, 5, 8, 1, 7, 21, 20, 1, 9, 40, 81, 43, 1, 1, 3, 1, 5, 8, 1, 7, 21, 20, 1, 9, 40, 81, 47, 1, 11, 65, 208, 295, 94, 1, 1, 3, 1, 5, 8, 1, 7, 21, 20, 1, 9, 40, 81, 48, 1, 11, 65, 208, 297, 107, 1, 13, 96, 425, 1024, 1037, 201
Offset: 2

Views

Author

Robert P. P. McKone, Feb 04 2021

Keywords

Examples

			For n = 5, k = 6 and r = 4, there are 65 strings: {000000, 000001, 000002, 000003, 000004, 000010, 000011, 000012, 000013, 000014, 000020, 000021, 000022, 000023, 000024, 000030, 000031, 000032, 000033, 000034, 000040, 000041, 000042, 000043, 000044, 010000, 020000, 030000, 040000, 100000, 100001, 100002, 100003, 100004, 110000, 120000, 130000, 140000, 200000, 200001, 200002, 200003, 200004, 210000, 220000, 230000, 240000, 300000, 300001, 300002, 300003, 300004, 310000, 320000, 330000, 340000, 400000, 400001, 400002, 400003, 400004, 410000, 420000, 430000, 440000}
The first seven slices of the tetrahedron (or pyramid) are:
-----------------Slice 1-----------------
  1
-----------------Slice 2-----------------
    1
  1  3
-----------------Slice 3-----------------
      1
    1  3
  1  5  8
-----------------Slice 4-----------------
        1
      1  3
    1  5   8
  1  7  21  19
-----------------Slice 5-----------------
          1
        1  3
      1  5   8
    1  7  21  20
  1  9  40  81  43
-----------------Slice 6-----------------
              1
           1    3
        1    5     8
      1   7    21    20
    1   9   40    81    47
  1  11  65   208   295   94
-----------------Slice 7-----------------
                 1
              1     3
           1     5     8
         1    7     21    20
      1    9    40     81      48
    1   11   65    208     297     107
  1  13   96   425    1024    1037    201
		

Crossrefs

Cf. A340156 (r=2), A340242 (r=3).
Cf. A008466 (n=2, r=2), A186244 (n=3, r=2), A050231 (n=2, r=3), A231430 (n=3, r=3).
Cf. A000567 [(k=4, r=2),(k=5, r=3),(k=6, r=4),...,(k=x, r=x-2)].
Cf. A103532 [(k=6, r=3),(k=7, r=4),(k=8, r=5),...,(k=x, r=x-3)].

Programs

  • Mathematica
    m[r_, n_] := Normal[With[{p = 1/n}, SparseArray[{Band[{1, 2}] -> p, {i_, 1} /; i <= r -> 1 - p, {r + 1, r + 1} -> 1}]]]; T[n_, k_, r_] := MatrixPower[m[r, n], k][[1, r + 1]]*n^k; DeleteCases[Transpose[PadLeft[Reverse[Table[T[n, k, r], {k, 2, 8}, {r, 2, k}, {n, 2, r}], 2]], 2 <-> 3], 0, 3] // Flatten

A167826 a(n) is the number of n-tosses having a run of 3 or more heads and a run of 3 or more tails for a fair coin.

Original entry on oeis.org

0, 0, 0, 0, 0, 2, 8, 26, 74, 194, 482, 1152, 2674, 6068, 13524, 29704, 64460, 138482, 294988, 623834, 1311086, 2740666, 5702270, 11815752, 24395678, 50209572, 103048168, 210965064, 430938832, 878534170
Offset: 1

Views

Author

V.J. Pohjola, Nov 13 2009

Keywords

Crossrefs

Programs

  • Mathematica
    b[1] = 0; b[2] = 1; b[3] = 1; b[n_]: = b[n-1] + b[n-2] + b[n-3]; Table[2^n - 2*(Sum[b[n + 3 - i], {i, 1, 3}] - Fibonacci[n + 1]), {n, 1, 30}]
    LinearRecurrence[{4, -3, -3, 0, 3, 2}, {0, 0, 0, 0, 0, 2}, 50] (* G. C. Greubel, Jun 27 2016 *)

Formula

a(n) = 2^n - 2*(tribonacci(n+3) - Fibonacci(n+1)), where tribonacci = A000073.
From R. J. Mathar, Feb 06 2010: (Start)
a(n) = 4*a(n-1) - 3*a(n-2) - 3*a(n-3) + 3*a(n-5) + 2*a(n-6).
G.f.: -2*x^6/((2*x-1)*(x^2+x-1)*(x^3+x^2+x-1)). (End)

A369580 a(n) := f(n, n), where f(0,0) = 1/3, f(0,k) = 0 and f(k,0) = 3^(k-1) if k > 0, and f(n, m) = f(n, m-1) + f(n-1, m) + 3*f(n-1, m-1) otherwise.

Original entry on oeis.org

2, 16, 138, 1216, 10802, 96336, 861114, 7708416, 69072354, 619380496, 5557080938, 49879087296, 447852531986, 4022246329936, 36132550233498, 324645166734336, 2917340834679234, 26219438520320016, 235672871308226634, 2118552629658530496, 19046140604787232242, 171241206828437556816
Offset: 1

Views

Author

Tadayoshi Kamegai, Jan 26 2024

Keywords

Comments

Take turns flipping a fair coin. The first to n heads wins. Sequence gives numerator of probability of first player winning. The denominator is .3^(2n-1).
It appears that a(n) for any n is divisible by 2^(A001511(n)).

Crossrefs

Cf. A001511 (see comments), A162326 (see formula).

Programs

  • Python
    def lis(n):
        table = [[0]*(n+1) for _ in range(n+1)]
        table[1][1] = 2
        for i in range(1, n+1) :
            table[i][0] = 3**(i-1)
        for i in range(1, n+1) :
            for j in range(1, n+1) :
                if (i == 1 and j == 1) :
                    continue
                table[i][j] = table[i][j-1] + table[i-1][j] + 3*table[i-1][j-1]
        return [int(table[i][i]) for i in range(1, n+1)]

Formula

Limit_{n->oo} a(n)/3^(2n-1) = 1/2.
a(n) = Sum_{i>=n} Sum_{j=0..n-1} binomial(i-1,n-1)*binomial(i-1,j)*3^(2n-1)/2^(2i-1).
9*a(n) - a(n+1) = 2*A162326(n) (conjectured).
a(n) = 3^(2n-1)*A(n, n) where A(0, k) = 0 for k > 0, A(k, 0) = 1 for k >= 0 and A(n, m) = (A(n-1, m) + A(n, m-1) + A(n-1, m-1))/3.

A265725 Number of binary strings of length n having at least one run of length at least 4.

Original entry on oeis.org

0, 0, 0, 0, 2, 6, 16, 40, 94, 214, 476, 1040, 2242, 4782, 10112, 21232, 44318, 92046, 190364, 392264, 805746, 1650518, 3372816, 6877656, 13998142, 28442918, 57707324, 116925600, 236630274, 478372062, 966145664, 1949583456, 3930972094, 7920443038, 15948482236
Offset: 0

Views

Author

Jeffrey Shallit, Dec 14 2015

Keywords

Comments

A "run" is a contiguous block of consecutive identical terms.

Examples

			For n=5 there are 6 such strings: 00000, 00001, 01111, and their complements.
		

Crossrefs

Programs

  • PARI
    x='x+O('x^100); concat(vector(4), Vec(2*x^4/((2*x-1)*(x^3+x^2+x-1)))) \\ Altug Alkan, Dec 14 2015

Formula

a(n) = 2^n - 2*A000073(n+2).
a(n) = 2*A050231(n-1) for n>0.
G.f.: 2*x^4/((2*x-1)*(x^3+x^2+x-1)). - Alois P. Heinz, Dec 14 2015

Extensions

More terms from Alois P. Heinz, Dec 14 2015
Previous Showing 11-15 of 15 results.