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-10 of 12 results. Next

A057960 Number of base-5 (n+1)-digit numbers starting with a zero and with adjacent digits differing by one or less.

Original entry on oeis.org

1, 2, 5, 13, 35, 95, 259, 707, 1931, 5275, 14411, 39371, 107563, 293867, 802859, 2193451, 5992619, 16372139, 44729515, 122203307, 333865643, 912137899, 2492007083, 6808289963, 18600594091, 50817768107, 138836724395, 379308985003, 1036291418795, 2831200807595
Offset: 0

Views

Author

Henry Bottomley, May 18 2001

Keywords

Comments

Or, number of three-choice paths along a corridor of width 5 and length n, starting from one side.
If b(n) is the number of three-choice paths along a corridor of width 5 and length n, starting from any of the five positions at the beginning of the corridor, then b(n) = a(n+2) for n >= 0. - Pontus von Brömssen, Sep 06 2021

Examples

			a(6) = 259 since a(5) = 21 + 30 + 25 + 14 + 5 so a(6) = (21+30) + (21 + 30 + 25) + (30+25+14) + (25+14+5) + (14+5) = 51 + 76 + 69 + 44 + 19.
		

Crossrefs

The "three-choice" comes in the recurrence b(n+1, i) = b(n, i-1) + b(n, i) + b(n, i+1) if 1 <= i <= 5. Narrower corridors produce A000012, A000079, A000129, A001519. An infinitely wide corridor (i.e., just one wall) would produce A005773. Two-choice corridors are A000124, A000125, A000127.
Cf. A038754, A052948, A155020 (first differences), A188866.

Programs

  • Maple
    with(combstruct): ZL0:=S=Prod(Sequence(Prod(a, Sequence(b))), b): ZL1:=Prod(begin_blockP, Z, end_blockP): ZL2:=Prod(begin_blockLR, Z, Sequence(Prod(mu_length, Z), card>=1), end_blockLR): ZL3:=Prod(begin_blockRL, Sequence(Prod(mu_length, Z), card>=1), Z, end_blockRL):Q:=subs([a=Union(ZL1, ZL2, ZL3), b=ZL3], ZL0), begin_blockP=Epsilon, end_blockP=Epsilon, begin_blockLR=Epsilon, end_blockLR=Epsilon, begin_blockRL=Epsilon, end_blockRL=Epsilon, mu_length=Epsilon:temp15:=draw([S, {Q}, unlabelled], size=15):seq(count([S, {Q}, unlabelled], size=n+2), n=0..28); # Zerinvary Lajos, Mar 08 2008
  • Mathematica
    Join[{a=1,b=2},Table[c=(a+b)*2-1;a=b;b=c,{n,0,50}]] (* Vladimir Joseph Stephan Orlovsky, Nov 22 2010 *)
    CoefficientList[Series[(1-x-x^2)/((1-x)*(1-2*x-2*x^2)),{x,0,100}],x] (* Vincenzo Librandi, Aug 13 2012 *)
  • Python
    from functools import cache
    @cache
    def B(n, j):
        if not 0 <= j < 5:
            return 0
        if n == 0:
            return j == 0
        return B(n - 1, j - 1) + B(n - 1, j) + B(n - 1, j + 1)
    def A057960(n):
        return sum(B(n, j) for j in range(5))
    print([A057960(n) for n in range(30)]) # Pontus von Brömssen, Sep 06 2021

Formula

a(n) = Sum_{0 <= i <= 6} b(n, i) where b(n, 0) = b(n, 6) = 0, b(0, 1) = 1, b(0, n) = 0 if n <> 1 and b(n+1, i) = b(n, i-1) + b(n, i) + b(n, i+1) if 1 <= i <= 5.
a(n) = 3*a(n-1) - 2*a(n-3) = 2*A052948(n) - A052948(n-2).
a(n) = ceiling((1+sqrt(3))^(n+2)/12). - Mitch Harris, Apr 26 2006
a(n) = floor(a(n-1)*(a(n-1) + 1/2)/a(n-2)). - Franklin T. Adams-Watters and Max Alekseyev, Apr 25 2006
a(n) = floor(a(n-1)*(1+sqrt(3))). - Philippe Deléham, Jul 25 2003
From Paul Barry, Sep 16 2003: (Start)
G.f.: (1-x-x^2)/((1-x)*(1-2*x-2*x^2));
a(n) = 1/3 + (2+sqrt(3))*(1+sqrt(3))^n/6 + (2-sqrt(3))*(1-sqrt(3))^n/6.
Binomial transform of A038754 (with extra leading 1). (End)
More generally, it appears that a(base,n) = a(base-1,n) + 3^(n-1) for base >= n; a(base,n) = a(base-1,n) + 3^(n-1)-2 when base = n-1. - R. H. Hardin, Dec 26 2006
a(n) = A188866(4,n-1) for n >= 2. - Pontus von Brömssen, Sep 06 2021
a(n) = 2*a(n-1) + 2*a(n-2) - 1 for n >= 2, a(0) = 1, a(1) = 2. - Philippe Deléham, Mar 01 2024
E.g.f.: exp(x)*(1 + 2*cosh(sqrt(3)*x) + sqrt(3)*sinh(sqrt(3)*x))/3. - Stefano Spezia, Mar 02 2024

Extensions

This is the result of merging two identical entries submitted by Henry Bottomley and R. H. Hardin. - N. J. A. Sloane, Aug 14 2012
Name clarified by Pontus von Brömssen, Sep 06 2021

A220062 Number A(n,k) of n length words over k-ary alphabet, where neighboring letters are neighbors in the alphabet; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 1, 2, 0, 0, 1, 3, 2, 0, 0, 1, 4, 4, 2, 0, 0, 1, 5, 6, 6, 2, 0, 0, 1, 6, 8, 10, 8, 2, 0, 0, 1, 7, 10, 14, 16, 12, 2, 0, 0, 1, 8, 12, 18, 24, 26, 16, 2, 0, 0, 1, 9, 14, 22, 32, 42, 42, 24, 2, 0, 0, 1, 10, 16, 26, 40, 58, 72, 68, 32, 2, 0, 0
Offset: 0

Views

Author

Alois P. Heinz, Dec 03 2012

Keywords

Comments

Equivalently, the number of walks of length n-1 on the path graph P_k. - Andrew Howroyd, Apr 17 2017

Examples

			A(5,3) = 12: there are 12 words of length 5 over 3-ary alphabet {a,b,c}, where neighboring letters are neighbors in the alphabet: ababa, ababc, abcba, abcbc, babab, babcb, bcbab, bcbcb, cbaba, cbabc, cbcba, cbcbc.
Square array A(n,k) begins:
  1,  1,  1,  1,  1,   1,   1,   1, ...
  0,  1,  2,  3,  4,   5,   6,   7, ...
  0,  0,  2,  4,  6,   8,  10,  12, ...
  0,  0,  2,  6, 10,  14,  18,  22, ...
  0,  0,  2,  8, 16,  24,  32,  40, ...
  0,  0,  2, 12, 26,  42,  58,  74, ...
  0,  0,  2, 16, 42,  72, 104, 136, ...
  0,  0,  2, 24, 68, 126, 188, 252, ...
		

Crossrefs

Columns k=0, 2-10 give: A000007, A040000, A029744(n+2) for n>0, A006355(n+3) for n>0, A090993(n+1) for n>0, A090995(n-1) for n>2, A129639, A153340, A153362, A153360.
Rows 0-6 give: A000012, A001477, A005843(k-1) for k>0, A016825(k-2) for k>1, A008590(k-2) for k>2, A113770(k-2) for k>3, A063164(k-2) for k>4.
Main diagonal gives: A102699.

Programs

  • Maple
    b:= proc(n, i, k) option remember; `if`(n=0, 1,
          `if`(i=0, add(b(n-1, j, k), j=1..k),
          `if`(i>1, b(n-1, i-1, k), 0)+
          `if`(i b(n, 0, k):
    seq(seq(A(n, d-n), n=0..d), d=0..14);
  • Mathematica
    b[n_, i_, k_] := b[n, i, k] = If[n == 0, 1, If[i == 0, Sum[b[n-1, j, k], {j, 1, k}], If[i>1, b[n-1, i-1, k], 0] + If[iJean-François Alcover, Jan 19 2015, after Alois P. Heinz *)
  • PARI
    TransferGf(m,u,t,v,z)=vector(m,i,u(i))*matsolve(matid(m)-z*matrix(m,m,i,j,t(i,j)),vectorv(m,i,v(i)));
    ColGf(m,z)=1+z*TransferGf(m, i->1, (i,j)->abs(i-j)==1, j->1, z);
    a(n,k)=Vec(ColGf(k,x) + O(x^(n+1)))[n+1];
    for(n=0, 7, for(k=0, 7, print1( a(n,k), ", ") ); print(); );
    \\ Andrew Howroyd, Apr 17 2017

A276562 Array read by antidiagonals: T(m,n) = number of m-ary words of length n with cyclically adjacent elements differing by 1 or less.

Original entry on oeis.org

1, 1, 2, 1, 4, 3, 1, 8, 7, 4, 1, 16, 15, 10, 5, 1, 32, 35, 22, 13, 6, 1, 64, 83, 54, 29, 16, 7, 1, 128, 199, 134, 73, 36, 19, 8, 1, 256, 479, 340, 185, 92, 43, 22, 9, 1, 512, 1155, 872, 481, 236, 111, 50, 25, 10, 1, 1024, 2787, 2254, 1265, 622, 287, 130, 57, 28, 11
Offset: 1

Views

Author

Andrew Howroyd, Apr 15 2017

Keywords

Comments

All rows are linear recurrences with constant coefficients. See PARI script to obtain generating functions.

Examples

			Array starts:
   1  1  1   1   1    1    1    1     1     1 ...
   2  4  8  16  32   64  128  256   512  1024 ...
   3  7 15  35  83  199  479 1155  2787  6727 ...
   4 10 22  54 134  340  872 2254  5854 15250 ...
   5 13 29  73 185  481 1265 3361  8993 24193 ...
   6 16 36  92 236  622 1658 4468 12132 33146 ...
   7 19 43 111 287  763 2051 5575 15271 42099 ...
   8 22 50 130 338  904 2444 6682 18410 51052 ...
   9 25 57 149 389 1045 2837 7789 21549 60005 ...
  10 28 64 168 440 1186 3230 8896 24688 68958 ...
		

Crossrefs

Programs

  • Mathematica
    T[m_, n_] := Sum[(1 + 2*Cos[j*Pi/(m+1)])^n, {j, 1, m}] // FullSimplify;
    Table[T[m-n+1, n], {m, 1, 11}, {n, m, 1, -1}] // Flatten (* Jean-François Alcover, Jun 06 2017 *)
  • PARI
    \\ from Knopfmacher et al.
    ChebyshevU(n,x) = sum(i=0, n/2, 2*poltchebi(n-2*i,x)) + (n%2-1);
    RowGf(k,x) = 1 + (k*x*(1+3*x) - 2*(k+1)*x*subst(ChebyshevU(k-1,z)/ChebyshevU(k,z),z,(1-x)/(2*x)))/((1+x)*(1-3*x));
    a(m,n)=Vec(RowGf(m,x)+O(x^(n+1)))[n+1];
    for(m=1, 10, print(RowGf(m,x)));
    for(m=1, 10, for(n=1, 9, print1( a(m,n), ", ") ); print(); );

Formula

T(m, n) = Sum_{j=1..m} (1 + 2*cos(j*pi/(m+1)))^n. - Andrew Howroyd, Apr 15 2017

A188861 Number of n X 4 binary arrays without the pattern 0 1 diagonally, vertically or antidiagonally.

Original entry on oeis.org

16, 41, 68, 95, 122, 149, 176, 203, 230, 257, 284, 311, 338, 365, 392, 419, 446, 473, 500, 527, 554, 581, 608, 635, 662, 689, 716, 743, 770, 797, 824, 851, 878, 905, 932, 959, 986, 1013, 1040, 1067, 1094, 1121, 1148, 1175, 1202, 1229, 1256, 1283, 1310, 1337, 1364
Offset: 1

Views

Author

R. H. Hardin, Apr 12 2011

Keywords

Comments

Column 4 of A188866.

Examples

			Some solutions for 3 X 4:
..1..1..1..1....1..1..0..1....1..1..1..1....1..0..1..1....1..1..1..1
..1..1..1..1....0..0..0..0....1..1..1..0....0..0..0..0....0..0..1..0
..1..0..0..1....0..0..0..0....1..1..0..0....0..0..0..0....0..0..0..0
		

Crossrefs

Cf. A188866.

Programs

Formula

Empirical: a(n) = 27*n - 13 for n>1.
Conjectures from Colin Barker, Feb 28 2018: (Start)
G.f.: x*(16 + 9*x + 2*x^2) / (1 - x)^2.
a(n) = 2*a(n-1) - a(n-2) for n>3.
(End)

A285266 Array read by antidiagonals: T(m,n) = number of m-ary words of length n with adjacent elements differing by 2 or less.

Original entry on oeis.org

1, 3, 1, 9, 4, 1, 27, 14, 5, 1, 81, 50, 19, 6, 1, 243, 178, 75, 24, 7, 1, 729, 634, 295, 100, 29, 8, 1, 2187, 2258, 1161, 418, 125, 34, 9, 1, 6561, 8042, 4569, 1748, 543, 150, 39, 10, 1, 19683, 28642, 17981, 7310, 2363, 668, 175, 44, 11, 1
Offset: 3

Views

Author

Andrew Howroyd, Apr 15 2017

Keywords

Comments

All rows are linear recurrences with constant coefficients. See PARI script to obtain generating functions.

Examples

			Array starts (m>=3, n>=0):
1  3  9  27  81  243   729  2187   6561 ...
1  4 14  50 178  634  2258  8042  28642 ...
1  5 19  75 295 1161  4569 17981  70763 ...
1  6 24 100 418 1748  7310 30570 127842 ...
1  7 29 125 543 2363 10287 44787 194995 ...
1  8 34 150 668 2986 13362 59816 267802 ...
1  9 39 175 793 3611 16475 75229 343633 ...
1 10 44 200 918 4236 19598 90790 420870 ...
		

Crossrefs

Rows 4-32 are A055099, A126392-A126419.

Programs

  • Mathematica
    diff = 2; m0 = 3; mmax = 12;
    TransferGf[m_, u_, t_, v_, z_] := Array[u, m].LinearSolve[IdentityMatrix[m] - z*Array[t, {m, m}], Array[v, m]]
    RowGf[d_, m_, z_] := 1+z*TransferGf[m, 1&, Boole[Abs[#1-#2] <= d]&, 1&, z];
    row[m_] := row[m] = CoefficientList[RowGf[diff, m, x] + O[x]^mmax, x];
    T[m_ /; m >= m0, n_ /; n >= 0] := row[m][[n + 1]];
    Table[T[m - n , n], {m, m0, mmax}, {n, m - m0, 0, -1}] // Flatten (* Jean-François Alcover, Jun 17 2017, adapted from PARI *)
  • PARI
    TransferGf(m,u,t,v,z)=vector(m,i,u(i))*matsolve(matid(m)-z*matrix(m,m,i,j,t(i,j)),vectorv(m,i,v(i)));
    RowGf(d,m,z)=1+z*TransferGf(m, i->1, (i,j)->abs(i-j)<=d, j->1, z);
    for(m=3, 10, print(RowGf(2,m,x)));
    for(m=3, 10, v=Vec(RowGf(2,m,x) + O(x^9)); for(n=1, length(v), print1( v[n], ", ") ); print(); );

A285267 Array read by antidiagonals: T(m,n) = number of m-ary words of length n with adjacent elements differing by 3 or less.

Original entry on oeis.org

1, 4, 1, 16, 5, 1, 64, 23, 6, 1, 256, 107, 30, 7, 1, 1024, 497, 154, 37, 8, 1, 4096, 2309, 788, 203, 44, 9, 1, 16384, 10727, 4034, 1111, 252, 51, 10, 1, 65536, 49835, 20650, 6083, 1446, 301, 58, 11, 1, 262144, 231521, 105708, 33305, 8300, 1787, 350, 65, 12, 1
Offset: 4

Views

Author

Andrew Howroyd, Apr 15 2017

Keywords

Comments

All rows are linear recurrences with constant coefficients. See PARI script to obtain generating functions.

Examples

			Array starts (m>=4, n>=0):
1  4 16  64  256  1024  4096  16384 ...
1  5 23 107  497  2309 10727  49835 ...
1  6 30 154  788  4034 20650 105708 ...
1  7 37 203 1111  6083 33305 182349 ...
1  8 44 252 1446  8300 47642 273466 ...
1  9 51 301 1787 10619 63111 375091 ...
1 10 58 350 2130 12990 79258 483646 ...
1 11 65 399 2473 15381 95757 596341 ...
		

Crossrefs

Rows 5-32 are A126473-A126500.

Programs

  • Mathematica
    diff = 3; m0 = 4; mmax = 13;
    TransferGf[m_, u_, t_, v_, z_] := Array[u, m].LinearSolve[IdentityMatrix[m] - z*Array[t, {m, m}], Array[v, m]]
    RowGf[d_, m_, z_] := 1+z*TransferGf[m, 1&, Boole[Abs[#1-#2] <= d]&, 1&, z];
    row[m_] := row[m] = CoefficientList[RowGf[diff, m, x] + O[x]^mmax, x];
    T[m_ /; m >= m0, n_ /; n >= 0] := row[m][[n + 1]];
    Table[T[m - n, n], {m, m0, mmax}, {n, m - m0, 0, -1}] // Flatten (* Jean-François Alcover, Jun 17 2017, adapted from PARI *)
  • PARI
    TransferGf(m,u,t,v,z)=vector(m,i,u(i))*matsolve(matid(m)-z*matrix(m,m,i,j,t(i,j)),vectorv(m,i,v(i)));
    RowGf(d,m,z)=1+z*TransferGf(m, i->1, (i,j)->abs(i-j)<=d, j->1, z);
    for(m=4, 12, print(RowGf(3,m,x)));
    for(m=4, 12, v=Vec(RowGf(3,m,x) + O(x^9)); for(n=1, length(v), print1( v[n], ", ") ); print(); );

A188860 Number of n X n binary arrays without the pattern 0 1 diagonally, vertically or antidiagonally.

Original entry on oeis.org

1, 2, 7, 26, 95, 340, 1193, 4116, 14001, 47064, 156629, 516844, 1693073, 5511218, 17841247, 57477542, 184377699, 589195584, 1876395357, 5957318820, 18861068265, 59563612974, 187668462027, 590039959434, 1851508693479, 5799494052414, 18135645594003
Offset: 0

Views

Author

R. H. Hardin, Apr 12 2011

Keywords

Comments

Diagonal of A188866.

Examples

			Some solutions for 3X3
..1..1..1....0..0..0....1..1..1....1..1..1....1..1..0....1..1..1....1..1..1
..1..1..1....0..0..0....1..1..1....1..0..0....0..0..0....1..1..1....1..1..1
..1..1..0....0..0..0....1..0..0....0..0..0....0..0..0....1..0..1....0..0..0
		

Crossrefs

Cf. A188866.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<3, (2*n-1)*n+1,
          ((10*n^2-49*n+33)*a(n-1)-(6*n^2-9*n-33)*a(n-2)
           -(9*(n-3))*(2*n-7)*a(n-3))/((n-1)*(2*n-9)))
        end:
    seq(a(n), n=0..35);  # Alois P. Heinz, Mar 30 2017

Formula

G.f.: (3*x^2-3*x+1-x*sqrt(1-3*x^2-2*x))/(1-3*x)^2. - Alois P. Heinz, Mar 30 2017

Extensions

a(0)=1 prepended by Alois P. Heinz, Mar 30 2017

A188865 Number of n X 8 binary arrays without the pattern 0 1 diagonally, vertically or antidiagonally.

Original entry on oeis.org

256, 1393, 3194, 5275, 7442, 9627, 11814, 14001, 16188, 18375, 20562, 22749, 24936, 27123, 29310, 31497, 33684, 35871, 38058, 40245, 42432, 44619, 46806, 48993, 51180, 53367, 55554, 57741, 59928, 62115, 64302, 66489, 68676, 70863, 73050, 75237, 77424
Offset: 1

Views

Author

R. H. Hardin, Apr 12 2011

Keywords

Comments

Column 8 of A188866.

Examples

			Some solutions for 3 X 8:
..1..1..1..1..1..1..1..1....1..1..1..1..1..1..1..1....1..1..0..1..1..1..1..1
..1..1..1..1..1..1..1..1....1..1..1..1..1..1..1..1....0..0..0..0..1..1..1..1
..0..0..0..0..1..1..1..0....0..0..1..0..1..1..1..0....0..0..0..0..0..0..0..0
		

Crossrefs

Cf. A188866.

Formula

Empirical: a(n) = 2187*n - 3495 for n>5.
Conjectures from Colin Barker, Feb 28 2018: (Start)
G.f.: x*(256 + 881*x + 664*x^2 + 280*x^3 + 86*x^4 + 18*x^5 + 2*x^6) / (1 - x)^2.
a(n) = 2*a(n-1) - a(n-2) for n>7.
(End)

A188862 Number of n X 5 binary arrays without the pattern 0 1 diagonally, vertically or antidiagonally.

Original entry on oeis.org

32, 99, 178, 259, 340, 421, 502, 583, 664, 745, 826, 907, 988, 1069, 1150, 1231, 1312, 1393, 1474, 1555, 1636, 1717, 1798, 1879, 1960, 2041, 2122, 2203, 2284, 2365, 2446, 2527, 2608, 2689, 2770, 2851, 2932, 3013, 3094, 3175, 3256, 3337, 3418, 3499, 3580
Offset: 1

Views

Author

R. H. Hardin, Apr 12 2011

Keywords

Comments

Column 5 of A188866.

Examples

			Some solutions for 3 X 5:
..1..1..1..1..0....1..1..1..1..1....1..1..1..1..1....1..1..1..1..1
..1..0..0..0..0....1..1..0..1..1....0..1..1..1..1....1..1..1..1..1
..0..0..0..0..0....0..0..0..0..0....0..0..1..0..1....0..1..0..1..1
		

Crossrefs

Cf. A188866.

Formula

Empirical: a(n) = 81*n - 65 for n>2.
Empirical g.f.: x*(32 + 35*x + 12*x^2 + 2*x^3) / (1 - x)^2. - Colin Barker, May 01 2018

A188863 Number of n X 6 binary arrays without the pattern 0 1 diagonally, vertically or antidiagonally.

Original entry on oeis.org

64, 239, 466, 707, 950, 1193, 1436, 1679, 1922, 2165, 2408, 2651, 2894, 3137, 3380, 3623, 3866, 4109, 4352, 4595, 4838, 5081, 5324, 5567, 5810, 6053, 6296, 6539, 6782, 7025, 7268, 7511, 7754, 7997, 8240, 8483, 8726, 8969, 9212, 9455, 9698, 9941, 10184
Offset: 1

Views

Author

R. H. Hardin, Apr 12 2011

Keywords

Comments

Column 6 of A188866.

Examples

			Some solutions for 3 X 6:
..1..1..1..0..1..1....1..0..0..0..0..0....1..1..1..1..1..0....1..1..1..1..1..1
..0..0..0..0..0..0....0..0..0..0..0..0....1..0..1..0..0..0....0..1..1..1..1..1
..0..0..0..0..0..0....0..0..0..0..0..0....0..0..0..0..0..0....0..0..0..1..1..0
		

Crossrefs

Cf. A188866.

Formula

Empirical: a(n) = 243*n - 265 for n>3.
Empirical g.f.: x*(64 + 111*x + 52*x^2 + 14*x^3 + 2*x^4) / (1 - x)^2. - Colin Barker, May 01 2018
Showing 1-10 of 12 results. Next