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.

A008466 a(n) = 2^n - Fibonacci(n+2).

Original entry on oeis.org

0, 0, 1, 3, 8, 19, 43, 94, 201, 423, 880, 1815, 3719, 7582, 15397, 31171, 62952, 126891, 255379, 513342, 1030865, 2068495, 4147936, 8313583, 16655823, 33358014, 66791053, 133703499, 267603416, 535524643, 1071563515, 2143959070, 4289264409, 8580707127
Offset: 0

Views

Author

Keywords

Comments

Toss a fair coin n times; a(n) is number of possible outcomes having a run of 2 or more heads.
Also the number of binary words of length n with at least two neighboring 1 digits. For example, a(4)=8 because 8 binary words of length 4 have two or more neighboring 1 digits: 0011, 0110, 0111, 1011, 1100, 1101, 1110, 1111 (cf. A143291). - Alois P. Heinz, Jul 18 2008
Equivalently, number of solutions (x_1, ..., x_n) to the equation x_1*x_2 + x_2*x_3 + x_3*x_4 + ... + x_{n-1}*x_n = 1 in base-2 lunar arithmetic. - N. J. A. Sloane, Apr 23 2011
Row sums of triangle A153281 = (1, 3, 8, 19, 43, ...). - Gary W. Adamson, Dec 23 2008
a(n-1) is the number of compositions of n with at least one part >= 3. - Joerg Arndt, Aug 06 2012
One less than the cardinality of the set of possible numbers of (leaf-) nodes of AVL trees with height n (cf. A143897, A217298). a(3) = 4-1, the set of possible numbers of (leaf-) nodes of AVL trees with height 3 is {5,6,7,8}. - Alois P. Heinz, Mar 20 2013
a(n) is the number of binary words of length n such that some prefix contains three more 1's than 0's or two more 0's than 1's. a(4) = 8 because we have: {0,0,0,0}, {0,0,0,1}, {0,0,1,0}, {0,0,1,1}, {0,1,0,0}, {1,0,0,0}, {1,1,1,0}, {1,1,1,1}. - Geoffrey Critzer, Dec 30 2013
With offset 0: antidiagonal sums of P(j,n) array of j-th partial sums of Fibonacci numbers. - Luciano Ancora, Apr 26 2015

Examples

			From _Gus Wiseman_, Jun 25 2020: (Start)
The a(2) = 1 through a(5) = 19 compositions of n + 1 with at least one part >= 3 are:
  (3)  (4)    (5)      (6)
       (1,3)  (1,4)    (1,5)
       (3,1)  (2,3)    (2,4)
              (3,2)    (3,3)
              (4,1)    (4,2)
              (1,1,3)  (5,1)
              (1,3,1)  (1,1,4)
              (3,1,1)  (1,2,3)
                       (1,3,2)
                       (1,4,1)
                       (2,1,3)
                       (2,3,1)
                       (3,1,2)
                       (3,2,1)
                       (4,1,1)
                       (1,1,1,3)
                       (1,1,3,1)
                       (1,3,1,1)
                       (3,1,1,1)
(End)
		

References

  • W. Feller, An Introduction to Probability Theory and Its Applications, Vol. 1, 2nd ed. New York: Wiley, p. 300, 1968.
  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 14, Exercise 1.

Crossrefs

Cf. A153281, A186244 (ternary words), A335457, A335458, A335516.
The non-contiguous version is A335455.
Row 2 of A340156. Column 3 of A109435.

Programs

  • Magma
    [2^n-Fibonacci(n+2): n in [0..40]]; // Vincenzo Librandi, Apr 27 2015
    
  • Maple
    a:= n-> (<<3|1|0>, <-1|0|1>, <-2|0|0>>^n)[1, 3]:
    seq(a(n), n=0..50); # Alois P. Heinz, Jul 18 2008
    # second Maple program:
    with(combinat): F:=fibonacci; f:=n->add(2^(n-1-i)*F(i),i=0..n-1); [seq(f(n),n=0..50)]; # N. J. A. Sloane, Mar 31 2014
  • Mathematica
    Table[2^n-Fibonacci[n+2],{n,0,20}] (* Vladimir Joseph Stephan Orlovsky, Jul 22 2008 *)
    MMM = 30;
    For[ M=2, M <= MMM, M++,
    vlist = Array[x, M];
    cl[i_] := And[ x[i], x[i+1] ];
    cl2 = False; For [ i=1, i <= M-1, i++, cl2 = Or[cl2, cl[i]] ];
    R[M] = SatisfiabilityCount[ cl2, vlist ] ]
    Table[ R[M], {M,2,MMM}]
    (* Find Boolean values of variables that satisfy the formula x1 x2 + x2 x3 + ... + xn-1 xn = 1; N. J. A. Sloane, Apr 23 2011 *)
    LinearRecurrence[{3,-1,-2},{0,0,1},40] (* Harvey P. Dale, Aug 09 2013 *)
    nn=33; a=1/(1-2x); b=1/(1-2x^2-x^4-x^6/(1-x^2));
    CoefficientList[Series[b(a x^3/(1-x^2)+x^2a),{x,0,nn}],x] (* Geoffrey Critzer, Dec 30 2013 *)
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n+1],Max@@#>2&]],{n,0,10}] (* Gus Wiseman, Jun 25 2020 *)
  • PARI
    a(n) = 2^n-fibonacci(n+2) \\ Charles R Greathouse IV, Feb 03 2014
    
  • SageMath
    def A008466(n): return 2^n - fibonacci(n+2) # G. C. Greubel, Apr 23 2025

Formula

a(1)=0, a(2)=1, a(3)=3, a(n) = 3*a(n-1) - a(n-2) - 2*a(n-3). - Miklos Kristof, Nov 24 2003
G.f.: x^2/((1-2*x)*(1-x-x^2)). - Paul Barry, Feb 16 2004
From Paul Barry, May 19 2004: (Start)
Convolution of Fibonacci(n) and (2^n - 0^n)/2.
a(n) = Sum_{k=0..n} (2^k-0^k)*Fibonacci(n-k)/2.
a(n+1) = Sum_{k=0..n} Fibonacci(k)*2^(n-k).
a(n) = 2^n*Sum_{k=0..n} Fibonacci(k)/2^k. (End)
a(n) = a(n-1) + a(n-2) + 2^(n-2). - Jon Stadler (jstadler(AT)capital.edu), Aug 21 2006
a(n) = 2*a(n-1) + Fibonacci(n-1). - Thomas M. Green, Aug 21 2007
a(n) = term (1,3) in the 3 X 3 matrix [3,1,0; -1,0,1; -2,0,0]^n. - Alois P. Heinz, Jul 18 2008
a(n) = 2*a(n-1) - a(n-3) + 2^(n-3). - Carmine Suriano, Mar 08 2011

A180165 Triangle read by rows, derived from an array of sequences generated from (1 + x)/ (1 - r*x - r*x^2).

Original entry on oeis.org

1, 1, 2, 1, 3, 3, 1, 4, 8, 5, 1, 5, 15, 22, 8, 1, 6, 24, 57, 60, 13, 1, 7, 35, 116, 216, 164, 21, 1, 8, 48, 205, 560, 819, 448, 34, 1, 9, 63, 330, 1200, 2704, 3105, 1224, 55, 1, 10, 80, 497, 2268, 7025, 13056, 11772, 3344, 89, 1, 11, 99, 712, 3920, 15588, 41125, 63040, 44631, 9136, 144
Offset: 1

Views

Author

Gary W. Adamson, Aug 14 2010

Keywords

Comments

Row sums = A180166: (1, 3, 7, 18, 51, 161, 560, 2163, ...).
Rows of the array, with other offsets: (row 1 = A000045 starting with offset 2: (1, 2, 3, 5, 8, 13, ...); and for rows > 1, the entries: A028859, A125145, A086347, and A180033 start with offset 0; with the offset in the present array = 1.

Examples

			First few rows of the triangle:
  1;
  1, 2;
  1, 3, 3;
  1, 4, 8, 5;
  1, 5, 15, 22, 8;
  1, 6, 24, 57, 60, 13;
  1, 7, 35, 116, 216, 164, 21;
  1, 8, 48, 205, 560, 819, 448, 34;
  1, 9, 63, 330, 1200, 2704, 3105, 1224, 55;
  1, 10, 80, 497, 2268, 7025, 13056, 11772, 3344, 89;
  1, 11, 99, 712, 3920, 15588, 41125, 63040, 44631, 9136, 144;
  1, 12, 120, 981, 6336, 30919, 107136, 240750, 304384, 169209, 24960, 233;
  ...
As an array A(r,k) by upwards antidiagonals:
        k=1  k=2  k=3   k=4    k=5
  r=1:   1,   2,    3,    5,     8, ...
  r=2:   1,   3,    8,   22,    60, ...
  r=3:   1,   4,   15,   57,   216, ...
  r=4:   1,   5,   24,  116,   560, ...
  r=5:   1,   6,   35,  205,  1200, ...
Row r=5 = A180033 = (1, 6, 35, 205,...) and is generated from (1+x)/(1-5*x-5*x^2); is the INVERT transform of row r=4; and the array term A(5,4) = 205 = 5*35 + 5*6.
Terms A(2,4) and A(2,5) = [22,60] = [0,1; 2,2]^3 * [1,3].
		

Crossrefs

Programs

  • Mathematica
    A180165[a_] := Reverse[Table[Table[CoefficientList[Series[(1 + x)/(1 - r*x - r*x^2), {x, 0, a - 2}], x], {r, 1, a + 1}][[k, n - k]], {n, 1, a}, {k, 1, n - 1}], 2] // Flatten;
    A180165[12] (* Robert P. P. McKone, Jan 19 2021 *)

Formula

Triangle read by rows, generated from an array of sequences generated from (1 + x)/(1 - r*x - r*x^2); r > 0.
Alternatively, given the array with offset 1, the sequence r-th sequence is generated from a(k) = r*a(k-1) + r*(k-2); a(1) = 1, a(2) = r+1.
With a matrix method, the array can be generated from a 2 X 2 matrix of the form [0,1; r,r] = M, such that M^n * [1,r+1] = [r,n+1; r,n+2].
Also, for r > 1, the (r+1)-th row of the array is the INVERT transform of the r-th row.

Extensions

a(35) corrected by Robert P. P. McKone, Dec 31 2020

A340242 Square array read by upward antidiagonals: T(n,k) is the number of n-ary strings of length k containing 000.

Original entry on oeis.org

1, 1, 3, 1, 5, 8, 1, 7, 21, 20, 1, 9, 40, 81, 47, 1, 11, 65, 208, 295, 107, 1, 13, 96, 425, 1021, 1037, 238, 1, 15, 133, 756, 2621, 4831, 3555, 520, 1, 17, 176, 1225, 5611, 15569, 22276, 11961, 1121, 1, 19, 225, 1856, 10627, 40091, 90085, 100768, 39667, 2391
Offset: 2

Views

Author

Robert P. P. McKone, Jan 01 2021

Keywords

Examples

			For n = 4 and k = 5, there are 40 strings: {00000, 00001, 00002, 00003, 00010, 00011, 00012, 00013, 00020, 00021, 00022, 00023, 00030, 00031, 00032, 00033, 01000, 02000, 03000, 10000, 10001, 10002, 10003, 11000, 12000, 13000, 20000, 20001, 20002, 20003, 21000, 22000, 23000, 30000, 30001, 30002, 30003, 31000, 32000, 33000}.
Square table T(n,k):
      k=3: k=4:  k=5:   k=6:    k=7:     k=8:
n=2:    1    3     8     20      47      107
n=3:    1    5    21     81     295     1037
n=4:    1    7    40    208    1021     4831
n=5:    1    9    65    425    2621    15569
n=6:    1   11    96    756    5611    40091
n=7:    1   13   133   1225   10627    88717
n=8:    1   15   176   1856   18425   175967
n=9:    1   17   225   2673   29881   321281
		

Crossrefs

Rows: A050231 (n=2), A231430 (n=3).
Columns: A000567 (k=5), A103532 (k=6).
Cf. A340156 (containing 00).
Cf. A341050.

Programs

  • Mathematica
    m[r_] := 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], k][[1, r + 1]]*n^k;
    Reverse[Table[T[n, k - n + 3, 3], {k, 2, 11}, {n, 2, k}], 2] // Flatten
  • PARI
    my(x2='x^2+'x+1); T(n,k) = n^k - polcoeff(lift(x2*Mod('x, 'x^3-(n-1)*x2)^k), 2); \\ Kevin Ryde, Jan 02 2021

Formula

m(3) = [1 - 1/n, 1/n, 0, 0; 1 - 1/n, 0, 1/n, 0; 1 - 1/n, 0, 0, 1/n; 0, 0, 0, 1], is the probability/transition matrix for three consecutive "0" -> "containing 000".

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