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

A124696 Number of base-3 circular n-digit numbers with adjacent digits differing by 1 or less.

Original entry on oeis.org

1, 3, 7, 15, 35, 83, 199, 479, 1155, 2787, 6727, 16239, 39203, 94643, 228487, 551615, 1331715, 3215043, 7761799, 18738639, 45239075, 109216787, 263672647, 636562079, 1536796803, 3710155683, 8957108167, 21624372015, 52205852195
Offset: 0

Views

Author

R. H. Hardin, Dec 28 2006

Keywords

Comments

These are the number of smooth cyclic words of length n over the alphabet {1,2,3}. See theorem 3.3 in Knopfmacher and others. - Peter Luschny, Aug 13 2012
This is the main entry for 234 similar sequences. Cf. the link to the OEIS Wiki for a list, the programs and a derivation of the linear recurrences. - Georg Fischer, Apr 09 2021

Crossrefs

Cf. A002426, Row 3 of A276562.

Programs

  • Maple
    T := (n, k) -> `if`(n=0, 1, add((1 + 2*cos(j*Pi/(k + 1)))^n, j=1..k)):
    a := n -> simplify(T(n, 3)): seq(a(n), n=0..28); # Peter Luschny, Mar 28 2021

Formula

[Empirical] a(base,n) = a(base-1,n) + A002426(n+1) for base = 1..floor(n/2)+1.
a(n) = T(n,3) for n > 0, where T(n,k) = Sum_{j=1..k} (1 + 2*cos(j*Pi/(k + 1)))^n. - Peter Luschny, Aug 13 2012
From Colin Barker, Nov 26 2012: (Start)
a(n) = 1 + (1 - sqrt(2))^n + (1 + sqrt(2))^n for n > 0.
a(n) = 3*a(n-1) - a(n-2) - a(n-3) for n > 3.
G.f.: -(2*x^3 + x^2 - 1)/((x - 1)*(x^2 + 2*x - 1)). (End)
a(n) = A002203(n)+1, n>0. - R. J. Mathar, May 09 2023

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(); );

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

A188866 T(n,k) is the number of n X k binary arrays without the pattern 0 1 diagonally, vertically or antidiagonally.

Original entry on oeis.org

2, 4, 3, 8, 7, 4, 16, 17, 10, 5, 32, 41, 26, 13, 6, 64, 99, 68, 35, 16, 7, 128, 239, 178, 95, 44, 19, 8, 256, 577, 466, 259, 122, 53, 22, 9, 512, 1393, 1220, 707, 340, 149, 62, 25, 10, 1024, 3363, 3194, 1931, 950, 421, 176, 71, 28, 11, 2048, 8119, 8362, 5275, 2658, 1193, 502, 203, 80, 31, 12
Offset: 1

Views

Author

R. H. Hardin, Apr 12 2011

Keywords

Comments

Number of 0..n strings of length k and adjacent elements differing by one or less. (See link for bijection.) Equivalently, number of base (n+1) k digit numbers with adjacent digits differing by one or less. - Andrew Howroyd, Mar 30 2017
All rows are linear recurrences with constant coefficients. See PARI script to obtain generating functions. - Andrew Howroyd, Apr 15 2017
Equivalently, the number of walks of length k-1 on the path graph P_{n+1} with a loop added at each vertex. - Pontus von Brömssen, Sep 08 2021

Examples

			Table starts:
   2  4  8  16  32   64  128   256   512   1024   2048    4096    8192    16384
   3  7 17  41  99  239  577  1393  3363   8119  19601   47321  114243   275807
   4 10 26  68 178  466 1220  3194  8362  21892  57314  150050  392836  1028458
   5 13 35  95 259  707 1931  5275 14411  39371 107563  293867  802859  2193451
   6 16 44 122 340  950 2658  7442 20844  58392 163594  458356 1284250  3598338
   7 19 53 149 421 1193 3387  9627 27383  77923 221805  631469 1797957  5119593
   8 22 62 176 502 1436 4116 11814 33942  97582 280676  807574 2324116  6689624
   9 25 71 203 583 1679 4845 14001 40503 117263 339699  984515 2854281  8277153
  10 28 80 230 664 1922 5574 16188 47064 136946 398746 1161634 3385486  9869934
  11 31 89 257 745 2165 6303 18375 53625 156629 457795 1338779 3916897 11463989
Some solutions for 5 X 3:
  1 1 1   1 1 1   1 1 1   1 1 1   0 0 0   1 1 1   1 1 1
  1 1 1   0 0 1   0 1 1   1 1 1   0 0 0   1 0 0   1 0 1
  0 0 0   0 0 0   0 0 1   1 1 1   0 0 0   0 0 0   0 0 0
  0 0 0   0 0 0   0 0 0   1 1 0   0 0 0   0 0 0   0 0 0
  0 0 0   0 0 0   0 0 0   0 0 0   0 0 0   0 0 0   0 0 0
		

Crossrefs

Columns 2..8 are A016777, A017257(n-1), A188861-A188865.
Rows 2..31 are A001333(n+1), A126358, A057960(n+1), A126360, A002714, A126362-A126386.
Main diagonal is A188860.

Programs

  • Mathematica
    rows = 11; rowGf[n_, x_] = 1 + (x*(n - (3*n + 2)*x) + (2*x^2)*(1 + ChebyshevU[n-1, (1-x)/(2*x)])/ChebyshevU[n, (1-x)/(2*x)])/(1-3*x)^2;
    row[n_] := rowGf[n+1, x] + O[x]^(rows+1) // CoefficientList[#, x]& // Rest; T = Array[row, rows]; Table[T[[n-k+1, k]], {n, 1, rows}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Oct 07 2017, after Andrew Howroyd *)
  • PARI
    \\ from Knopfmacher et al.
    RowGf(k, x='x) = my(z=(1-x)/(2*x)); 1 + (x*(k-(3*k+2)*x) + (2*x^2)*(1+polchebyshev(k-1, 2, z))/polchebyshev(k, 2, z))/(1-3*x)^2;
    T(n,k) = {polcoef(RowGf(n+1) + O(x*x^k),k)}
    for(n=1, 10, print(Vec(RowGf(n+1) + O(x^11)))) \\ Andrew Howroyd, Apr 15 2017 [updated Mar 13 2021]

Formula

Empirical: T(n,1) = n + 1.
Empirical: T(n,2) = 3*n + 1.
Empirical: T(n,3) = 9*n - 1.
Empirical: T(n,4) = 27*n - 13 for n > 1.
Empirical: T(n,5) = 81*n - 65 for n > 2.
Empirical: T(n,6) = 243*n - 265 for n > 3.
Empirical: T(n,7) = 729*n - 987 for n > 4.
Empirical: T(n,8) = 2187*n - 3495 for n > 5.
Empirical: T(1,k) = 2*T(1,k-1).
Empirical: T(2,k) = 2*T(2,k-1) + T(2,k-2).
Empirical: T(3,k) = 3*T(3,k-1) - T(3,k-2).
Empirical: T(4,k) = 3*T(4,k-1) - 2*T(4,k-3).
Empirical: T(5,k) = 4*T(5,k-1) - 3*T(5,k-2) - T(5,k-3).
Empirical: T(6,k) = 4*T(6,k-1) - 2*T(6,k-2) - 4*T(6,k-3) + T(6,k-4).
Empirical: T(7,k) = 5*T(7,k-1) - 6*T(7,k-2) - T(7,k-3) + 2*T(7,k-4).
Empirical: T(8,k) = 5*T(8,k-1) - 5*T(8,k-2) - 5*T(8,k-3) + 5*T(8,k-4) + T(8,k-5).

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

Original entry on oeis.org

1, 4, 1, 16, 5, 1, 64, 23, 6, 1, 256, 101, 30, 7, 1, 1024, 467, 138, 37, 8, 1, 4096, 2165, 694, 175, 44, 9, 1, 16384, 10055, 3526, 925, 212, 51, 10, 1, 65536, 46709, 18012, 4977, 1156, 249, 58, 11, 1, 262144, 216995, 92140, 27067, 6428, 1387, 286, 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

			Table starts (m>=4, n>=0):
1  4 16  64  256  1024  4096  16384   65536 ...
1  5 23 101  467  2165 10055  46709  216995 ...
1  6 30 138  694  3526 18012  92140  471566 ...
1  7 37 175  925  4977 27067 147777  808165 ...
1  8 44 212 1156  6428 36338 206942 1183164 ...
1  9 51 249 1387  7879 45663 267367 1575395 ...
1 10 58 286 1618  9330 54994 328058 1973026 ...
1 11 65 323 1849 10781 64325 388749 2371457 ...
1 12 72 360 2080 12232 73656 449440 2770016 ...
		

Crossrefs

Rows 5-32 are A124999, A125316-A125342.

Programs

  • Mathematica
    diff = 3; m0 = diff + 1; 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*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=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(); );

A124707 Number of base 14 circular n-digit numbers with adjacent digits differing by 1 or less.

Original entry on oeis.org

1, 14, 40, 92, 244, 644, 1750, 4802, 13324, 37244, 104770, 296222, 841114, 2396954, 6851920, 19639652, 56426044, 162453884, 468581890, 1353822062, 3917298334, 11350084334, 32926503100, 95626832432, 278010277474, 809008239794, 2356265478100, 6868253600552
Offset: 0

Views

Author

R. H. Hardin, Dec 28 2006

Keywords

Comments

[Empirical] a(base,n) = a(base-1,n)+A002426(n+1) for base>=1.int(n/2)+1
a(n) = T(n, 14) where T(n, k) = Sum_{j=1..k} (1+2*cos(j*Pi/(k+1)))^n. These are the number of smooth cyclic words of length n over the alphabet {1,2,..,14}. See theorem 3.3 in Knopfmacher and others, reference in A124696. - Peter Luschny, Aug 13 2012

Crossrefs

Except for the first term, row 14 of A276562.

Formula

G.f.: -(120*x^13 -55*x^12 -1200*x^11 +900*x^10 +2864*x^9 -3087*x^8 -1584*x^7 +3135*x^6 -792*x^5 -627*x^4 +416*x^3 -78*x^2 +1) / ((2*x-1) *(x^2-3*x+1) *(x^2+x-1) *(x^4+3*x^3-x^2-3*x+1) *(5*x^4-5*x^3-5*x^2+5*x-1)). - Alois P. Heinz, Apr 02 2025
Showing 1-6 of 6 results.