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

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

Original entry on oeis.org

1, 3, 1, 9, 4, 1, 27, 14, 5, 1, 81, 46, 19, 6, 1, 243, 162, 65, 24, 7, 1, 729, 574, 247, 84, 29, 8, 1, 2187, 2042, 955, 332, 103, 34, 9, 1, 6561, 7270, 3733, 1336, 417, 122, 39, 10, 1, 19683, 25890, 14649, 5478, 1717, 502, 141, 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

			Table starts (m>=3, n>=0):
1  3  9  27  81  243   729  2187 ...
1  4 14  46 162  574  2042  7270 ...
1  5 19  65 247  955  3733 14649 ...
1  6 24  84 332 1336  5478 22658 ...
1  7 29 103 417 1717  7229 30793 ...
1  8 34 122 502 2098  8980 38928 ...
1  9 39 141 587 2479 10731 47063 ...
1 10 44 160 672 2860 12482 55198 ...
		

Crossrefs

Programs

  • Mathematica
    diff = 2; m0 = diff + 1; 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*Sum[TransferGf[m, Boole[# == k] &, Boole[Abs[#1 - #2] <= d] &, Boole[Abs[# - k] <= d] &, z], {k, 1, m}];
    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 16 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*sum(k=1,m,TransferGf(m, i->if(i==k,1,0), (i,j)->abs(i-j)<=d, j->if(abs(j-k)<=d,1,0), z));
    for(m=3, 10, print(RowGf(2,m,x)));
    for(m=3, 10, v=Vec(RowGf(2,m,x) + O(x^8)); 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(); );
Showing 1-2 of 2 results.