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.

A209349 Number A(n,k) of initially rising meander words, where each letter of the cyclic k-ary alphabet occurs n times; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 5, 1, 0, 1, 1, 1, 9, 29, 1, 0, 1, 1, 1, 11, 100, 182, 1, 0, 1, 1, 1, 16, 182, 1225, 1198, 1, 0, 1, 1, 1, 19, 484, 3542, 15876, 8142, 1, 0, 1, 1, 1, 25, 902, 17956, 76258, 213444, 56620, 1, 0, 1
Offset: 0

Views

Author

Alois P. Heinz, Mar 06 2012

Keywords

Comments

In a meander word letters of neighboring positions have to be neighbors in the alphabet, where in a cyclic alphabet the first and the last letters are considered neighbors too. The words are not considered cyclic here.
A word is initially rising if it is empty or if it begins with the first letter of the alphabet that can only be followed by the second letter in this word position.
A(n,k) is also the number of (n*k-1)-step walks on k-dimensional cubic lattice from (1,0,...,0) to (n,n,...,n) with positive unit steps in all dimensions such that the indices of dimensions used in consecutive steps differ by 1 or are in the set {1,k}.

Examples

			A(0,0) = A(0,k) = A(n,0) = 1: the empty word.
A(1,1) = 1 = |{a}|.
A(2,1) = 0 = |{ }|.
A(2,2) = 1 = |{abab}|.
A(2,3) = 5 = |{abacbc, abcabc, abcacb, abcbac, abcbca}|.
A(1,4) = 1 = |{abcd}|.
A(2,4) = 9 = |{ababcdcd, abadcbcd, abadcdcb, abcbadcd, abcbcdad, abcdabcd, abcdadcb, abcdcbad, abcdcdab}|.
Square array A(n,k) begins:
1,  1,  1,    1,      1,       1,        1, ...
1,  1,  1,    1,      1,       1,        1, ...
1,  0,  1,    5,      9,      11,       16, ...
1,  0,  1,   29,    100,     182,      484, ...
1,  0,  1,  182,   1225,    3542,    17956, ...
1,  0,  1, 1198,  15876,   76258,   749956, ...
1,  0,  1, 8142, 213444, 1753522, 33779344, ...
		

Crossrefs

Rows n=0+1, 2-3 give: A000012, A209350, A240954.
Columns k=0+2, 3-7 give: A000012, A190917 = A110706/6, A060150 = A088218^2, A209351, A209352, A209353.

Programs

  • Maple
    b:= proc() option remember; local n; n:= nargs;
         `if`({args}={0}, 1,
           `if`(args[2]>0, b(args[2]-1, args[i]$i=3..n, args[1]), 0)+
           `if`(n>2 and args[n]>0, b(args[n]-1, args[i]$i=1..n-1), 0))
        end:
    A:= (n, k)-> `if`(n<2, 1, `if`(k<2, 1-k, b((n-1)$2, n$(k-2)))):
    seq(seq(A(n, d-n), n=0..d), d=0..10);
  • Mathematica
    b[args_List] := b[args] = Module[{n = Length[args]}, If[Union[args] == {0}, 1, If[args[[2]] > 0, b[Join[{args[[2]] - 1}, args[[3 ;; n]], { args[[1]]}]], 0] + If[n > 2 && args[[n]] > 0, b[Join[{args[[n]] - 1}, args[[1 ;; n - 1]]]], 0]]]; A[n_, k_] := If[n < 2, 1, If[k < 2, 1 - k, b[Join[{n - 1, n - 1}, Array[n&, k - 2]]]]]; Table[Table[A[n, d - n], {n, 0, d}], {d, 0, 10}] // Flatten (* Jean-François Alcover, Jan 21 2015, after Alois P. Heinz *)

A245578 The number of permutations of {0,0,1,1,...,n-1,n-1} that begin with 0 and in which adjacent elements are adjacent mod n.

Original entry on oeis.org

1, 10, 18, 22, 32, 38, 50, 58, 72, 82, 98, 110, 128, 142, 162, 178, 200, 218, 242, 262, 288, 310, 338, 362, 392, 418, 450, 478, 512, 542, 578, 610, 648, 682, 722, 758, 800, 838, 882, 922, 968, 1010, 1058, 1102, 1152, 1198, 1250, 1298, 1352, 1402, 1458, 1510, 1568, 1622, 1682, 1738, 1800, 1858, 1922, 1982, 2048, 2110
Offset: 2

Views

Author

Don Knuth, Jul 25 2014

Keywords

Comments

a(n) is also the number of random walks of length 2n in which every residue class mod n occurs twice (except that there are 8 such walks when n=2).

Examples

			a(3)=10 because of the solutions 012012,012021,012102,012120,010212, and their complements mod 3.
G.f. = x^2 + 10*x^3 + 18*x^4 + 22*x^5 + 32*x^6 + 38*x^7 + 50*x^8 + 58*x^9 + ...
		

Programs

  • Magma
    [1] cat [(3+5*(-1)^n+8*n+2*n^2)/4: n in [3..70]]; // Vincenzo Librandi, Aug 05 2014
  • Maple
    A245578 := n -> `if`(n=2, 1, (3+5*(-1)^n+8*n+2*n^2)/4);
    seq(A245578(n), n = 2..63); # Peter Luschny, Jul 26 2014
  • Mathematica
    CoefficientList[Series[(1 + 8 x - 2 x^2 - 12 x^3 + 7 x^4)/((1 + x) (1 - x)^3), {x, 0, 40}], x] (* Vincenzo Librandi, Aug 05 2014 *)
  • PARI
    Vec( x^2 * (1+8*x-2*x^2-12*x^3+7*x^4) / ((1+x) * (1-x)^3) + O(x^66) ) \\ Joerg Arndt, Jul 26 2014
    

Formula

a(n) = 2 * A209350(n) if n>2. - Michael Somos, Jul 26 2014
G.f.: x^2 * (1+8*x-2*x^2-12*x^3+7*x^4) / ((1+x) * (1-x)^3). - Joerg Arndt, Jul 26 2014
a(n) = (3+5*(-1)^n+8*n+2*n^2)/4 if n>2. - Peter Luschny, Jul 26 2014
E.g.f.: (5*exp(-x)+exp(x)*(2*x*(x+5)+3)-(14*x^2+8*(x+1)))/4. - Peter Luschny, Aug 04 2014

A245581 a(n) = (5 * (1 + (-1)^(1 + n)) + 2 * n^2) / 4.

Original entry on oeis.org

0, 3, 2, 7, 8, 15, 18, 27, 32, 43, 50, 63, 72, 87, 98, 115, 128, 147, 162, 183, 200, 223, 242, 267, 288, 315, 338, 367, 392, 423, 450, 483, 512, 547, 578, 615, 648, 687, 722, 763, 800, 843, 882, 927, 968, 1015, 1058, 1107, 1152, 1203, 1250, 1303, 1352, 1407
Offset: 0

Views

Author

Peter Luschny, Jul 26 2014

Keywords

Crossrefs

Programs

  • Magma
    [(5*(1+(-1)^(1+n))+2*n^2) / 4: n in [0..60]]; // Vincenzo Librandi, Jul 27 2014
  • Maple
    A245581 := n -> (5*(1+(-1)^(1+n))+2*n^2)/4; seq(A245581(n), n=0..53);
  • Mathematica
    CoefficientList[Series[-x (3 x^2 - 4 x + 3)/((x - 1)^3 (x + 1)), {x, 0, 40}], x] (* Vincenzo Librandi, Jul 27 2014 *)
  • PARI
    concat(0, Vec(-x*(3*x^2-4*x+3)/((x-1)^3*(x+1)) + O(x^100))) \\ Colin Barker, Jul 26 2014
    
  • Sage
    def A():
        a, b, c, d = 0, 3, 2, 7
        while True:
            yield a
            a, b, c, d = b, c, d, a + 2*(d - b)
    A245581 = A(); [next(A245581) for n in range(54)]
    

Formula

a(n) = a(-n).
a(2*n+1) = A097080(n+1).
a(2*n+6) = A245578(2*n+4) = 2*A209350(2*n+4).
a(n) = 2*a(n-1)-2*a(n-3)+a(n-4). - Colin Barker, Jul 26 2014
G.f.: -x*(3*x^2-4*x+3) / ((x-1)^3*(x+1)). - Colin Barker, Jul 26 2014
E.g.f.: (exp(x)*x*(x+1) + 5*sinh(x))/2. - Peter Luschny, Aug 04 2014
Showing 1-3 of 3 results.