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

A183134 Square array A(n,k) by antidiagonals. A(n,k) is the number of length 2n k-ary words (n,k>=0), either empty or beginning with the first character of the alphabet, that can be built by repeatedly inserting doublets into the initially empty word.

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 3, 1, 0, 1, 1, 5, 10, 1, 0, 1, 1, 7, 29, 35, 1, 0, 1, 1, 9, 58, 181, 126, 1, 0, 1, 1, 11, 97, 523, 1181, 462, 1, 0, 1, 1, 13, 146, 1145, 4966, 7941, 1716, 1, 0, 1, 1, 15, 205, 2131, 14289, 48838, 54573, 6435, 1, 0
Offset: 0

Views

Author

Alois P. Heinz, Dec 26 2010

Keywords

Comments

Column k > 2 is asymptotic to 2^(2*n) * (k-1)^(n+1) / ((k-2)^2 * sqrt(Pi) * n^(3/2)). - Vaclav Kotesovec, Sep 07 2014

Examples

			A(3,2) = 10, because 10 words of length 6 beginning with the first character of the 2-letter alphabet {a, b} can be built by repeatedly inserting doublets (words with two equal letters) into the initially empty word: aaaaaa, aaaabb, aaabba, aabaab, aabbaa, aabbbb, abaaba, abbaaa, abbabb, abbbba.
Square array A(n,k) begins:
  1,  1,   1,    1,    1,     1,  ...
  0,  1,   1,    1,    1,     1,  ...
  0,  1,   3,    5,    7,     9,  ...
  0,  1,  10,   29,   58,    97,  ...
  0,  1,  35,  181,  523,  1145,  ...
  0,  1, 126, 1181, 4966, 14289,  ...
		

Crossrefs

Columns 0-10 give: A000007, A000012, A001700(n-1) for n>0, A194723, A194724, A194725, A194726, A194727, A194728, A194729, A194730.
Main diagonal gives A248828.
Coefficients of row polynomials for k>0 in k, (k+1) are given by A050166, A157491.

Programs

  • Maple
    A:= proc(n, k)
          local j;
          if n=0  then 1
        elif k<=1 then k
                  else add(binomial(2*n,j)*(n-j)*(k-1)^j, j=0..n-1)/n
          fi
        end:
    seq(seq(A(n, d-n), n=0..d), d=0..10);
  • Mathematica
    a[n_, k_] := If[ n == 0, 1 , If[ k <= 1, k, Sum [Binomial[2*n, j]*(n-j)*(k-1)^j, {j, 0, n-1}] / n ] ]; Table[Table[a[n, d-n], {n, 0, d}], {d, 0, 10}] // Flatten (* Jean-François Alcover, Dec 09 2013, translated from Maple *)

Formula

A(n,k) = 1 if n=0, A(n,k) = k if n>0 and k<=1, and A(n,k) = 1/n * Sum_{j=0..n-1} C(2*n,j)*(n-j)*(k-1)^j else.
A(n,k) = A183135(n,k) if n=0 or k<2, A(n,k) = A183135(n,k)/k else.
G.f. of column k: 1/(1-k*x) if k<2, (1-1/k) * (1 + 2 / (k-2 + k * sqrt (1-(4*k-4)*x))) else.

A294491 Number of length 2n n-ary words that can be built by repeatedly inserting doublets into the initially empty word.

Original entry on oeis.org

1, 1, 6, 87, 2092, 71445, 3183156, 175466347, 11544312984, 883404542025, 77115832253380, 7564442149980111, 823833773843404776, 98644885379708947357, 12880909497761085034632, 1821689155897508835803475, 277402856595034529463789616, 45253909471856604392088994065
Offset: 0

Views

Author

Alois P. Heinz, Oct 31 2017

Keywords

Comments

Also the number of rooted closed walks of length 2n on the infinite rooted n-ary tree.

Examples

			a(2) = 6 because 6 words of length 4 can be built over 2-letter alphabet {a, b} by repeatedly inserting doublets (words with two equal letters) into the initially empty word: aaaa, aabb, abba, baab, bbaa, bbbb.
		

Crossrefs

Main diagonal of A183135.
Cf. A248828.

Programs

  • Maple
    a:= n-> `if`(n=0, 1, add(binomial(2*n, j)*(n-j)*(n-1)^j, j=0..n-1)):
    seq(a(n), n=0..21);

Formula

a(n) = Sum_{j=0..n-1} binomial(2*n,j)*(n-j)*(n-1)^j for n>0, a(0) = 1.
a(n) = [x^n] 2*(n-1)/(n-2+n*sqrt(1-(4*n-4)*x)) for n>1, a(n) = 1 for n<2.
a(n) = A183135(n,n).
a(n) = n * A248828(n) for n>0, a(0) = 1.

A378203 Number of palindromic n-ary words of length n that include the last letter of their respective alphabet.

Original entry on oeis.org

1, 1, 1, 5, 7, 61, 91, 1105, 1695, 26281, 40951, 771561, 1214423, 26916709, 42664987, 1087101569, 1732076671, 49868399761, 79771413871, 2560599031177, 4108933742199, 145477500542221, 234040800869107, 9059621800971105, 14605723004036255, 613627780919407801
Offset: 0

Views

Author

John Tyler Rascoe, Nov 19 2024

Keywords

Examples

			a(0) = 1: ().
a(1) = 1: (a).
a(2) = 1: (b,b).
a(3) = 5: (a,c,a), (b,c,b), (c,a,c), (c,b,c), (c,c,c).
		

Crossrefs

Programs

  • Maple
    a:= n-> (h-> n^h-`if`(n=0, 0, (n-1)^h))(ceil(n/2)):
    seq(a(n), n=0..25);  # Alois P. Heinz, Nov 21 2024
  • Mathematica
    h[n_] := Ceiling[n/2];a[n_] := n^h[n] - (n - 1)^h[n];Join[{1},Table[a[n],{n,25}]] (* James C. McMahon, Nov 21 2024 *)
  • PARI
    h(n) = {ceil(n/2)}
    a(n) = {n^h(n)-(n-1)^h(n)}
    
  • Python
    def A378203(n): return n**(m:=n+1>>1)-(n-1)**m if n else 1 # Chai Wah Wu, Nov 21 2024

Formula

a(n) = n^h(n) - (n-1)^h(n) for n > 0, where h(n) = ceiling(n/2).
a(n) = A047969(n-1,h(n)-1) for n > 0.
Showing 1-3 of 3 results.