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

A346380 Complement of A187430 in A000108.

Original entry on oeis.org

0, 0, 1, 0, 3, 3, 18, 39, 157, 459, 1668, 5503, 19638, 68325, 245144, 876438, 3177651, 11549939, 42307920, 155555733, 574881920, 2132231076, 7938771624, 29651189637, 111086480106, 417305224917, 1571633677078, 5932720163529, 22443721850064, 85075094996719, 323086777251300
Offset: 0

Views

Author

F. Chapoton, Jul 14 2021

Keywords

Comments

Related to the decomposition of A000108 as the sum of A055113 and A111160.

Crossrefs

Programs

  • Sage
    N = 30
    x = (PowerSeriesRing(QQ, 'x').0).O(N + 1)
    f = (x*(1-x^2)^2/(1+x^3)^2).reverse()
    g = sum(catalan_number(n)*x**n for n in range(N + 1)).O(N + 1)
    list(x*g-f)

Formula

G.f. y(x) satisfies x y^4 + 2 x^2 y^2 + x^3 + 3 x y^2 + y^3 - x y = 0.

A055113 Number of bracketings of 0^0^0^...^0, with n 0's, giving the result 0, with conventions that 0^0 = 1^0 = 1^1 = 1, 0^1 = 0.

Original entry on oeis.org

0, 1, 0, 1, 1, 5, 11, 41, 120, 421, 1381, 4840, 16721, 59357, 210861, 759071, 2744393, 10000437, 36609977, 134750450, 498016753, 1848174708, 6882643032, 25715836734, 96365606679, 362102430069, 1364028272451, 5150156201026, 19486989838057, 73880877535315
Offset: 0

Views

Author

Jeppe Stig Nielsen, Jun 15 2000

Keywords

Comments

Total number of bracketings of 0^0^...^0 is A000108(n-1) (this is Catalan's problem). So the number of bracketings giving 1 is A000108(n-1) - a(n).
Also bracketings of f => f => ... => f where f is "false" and "=>" is implication.
Self-convolution yields A187430. - Paul D. Hanna, May 31 2015
Also, number of nonnegative walks of n steps with step sizes 1 and 2, starting at 0 and ending at 1. - Andrew Howroyd, Dec 23 2017
Series reversion is related to A001006. - F. Chapoton, Jul 14 2021

Examples

			Number of bracketings of 0^0^0^0^0^0 giving 0 is 11, so a(6) = 11.
From _Jon E. Schoenfield_, Dec 24 2017: (Start)
The 11 ways of parenthesizing 0^0^0^0^0^0 to obtain 0 are
0^(0^(0^((0^0)^0))) = 0^(0^(0^(1^0))) = 0^(0^(0^1)) = 0^(0^0) = 0^1 = 0;
0^((0^0)^(0^(0^0))) = 0^(1^(0^1)) = 0^(1^0) = 0^1 = 0;
0^((0^0)^((0^0)^0)) = 0^(1^(1^0)) = 0^(1^1) = 0^1 = 0;
0^(((0^0)^0)^(0^0)) = 0^((1^0)^1) = 0^(1^1) = 0^1 = 0;
0^((0^(0^(0^0)))^0) = 0^((0^(0^1))^0) = 0^((0^0)^0) = 0^(1^0) = 0^1 = 0;
0^((0^((0^0)^0))^0) = 0^((0^(1^0))^0) = 0^((0^1)^0) = 0^(0^0) = 0^1 = 0;
0^(((0^0)^(0^0))^0) = 0^((1^1)^0) = 0^(1^0) = 0^1 = 0;
0^(((0^(0^0))^0)^0) = 0^(((0^1)^0)^0) = 0^((0^0)^0) = 0^(1^0) = 0^1 = 0;
0^((((0^0)^0)^0)^0) = 0^(((1^0)^0)^0) = 0^((1^0)^0) = 0^(1^0) = 0^1 = 0;
(0^(0^0))^((0^0)^0) = (0^1)^(1^0) = 0^1 = 0;
(0^((0^0)^0))^(0^0) = (0^(1^0))^1. (End)
		

References

  • Thanks to Soren Galatius Smith, Jesper Torp Kristensen et al.

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<3, n*(2-n),
          ((n-1)*(115*n^3-689*n^2+1332*n-840) *a(n-1)
           +(8*n-20)*(5*n^3+12*n^2-113*n+126) *a(n-2)
           -36*(n-3)*(5*n-8)*(2*n-5)*(2*n-7)  *a(n-3))
          /((2*(2*n-1))*(5*n-13)*n*(n-1)))
        end:
    seq(a(n), n=0..30);  # Alois P. Heinz, Mar 04 2019
  • Mathematica
    Rest[ CoefficientList[ Series[(-1 - Sqrt[1 - 4x] + Sqrt[2]Sqrt[1 + Sqrt[1 - 4x] + 6x])/4, {x, 0, 28}], x]] (* Robert G. Wilson v, Oct 28 2005 *)
    a[n_] := (-1)^(n+1)*Binomial[2n-1, n]*HypergeometricPFQ[{1-n, (n+1)/2, n/2}, {n, n+1}, 4]/(2n-1);
    Array[a, 27] (* Jean-François Alcover, Dec 26 2017, after Vladimir Kruchinin *)
  • Maxima
    a(n):= sum(binomial(2*j+n-1,j+n-1)*(-1)^(n-j-1)*binomial(2*n-1,j+n), j,0,n-1)/(2*n-1); /* Vladimir Kruchinin, May 10 2011 */
    
  • PARI
    a(n)={sum(j=0, n-1, binomial(2*j+n-1, j+n-1)*(-1)^(n-j-1)*binomial(2*n-1, j+n))/(2*n-1)} \\ Andrew Howroyd, Dec 23 2017
    
  • PARI
    first(n) = x='x+O('x^(n+1)); Vec(-((1 - 4*x)^(1/2) + 1)/4 + (2 + 2*(1 - 4*x)^(1/2) + 12*x)^(1/2)/4) \\ Iain Fox, Dec 23 2017

Formula

G.f.: - 1/4 - (1/4)*(1 - 4*x)^(1/2) + (1/4)*(2 + 2*(1 - 4*x)^(1/2) + 12*x)^(1/2).
The ratio a(n)/A000108(n-1) converges to (5-sqrt(5))/10 as n->oo.
a(n) = (Sum_{j=0..n-1} binomial(2*j+n-1, j+n-1)*(-1)^(n-j-1)*binomial(2*n-1, j+n))/(2*n-1). - Vladimir Kruchinin, May 10 2011
a(n) ~ (1-1/sqrt(5))*2^(2*n-3)/(sqrt(Pi)*n^(3/2)). - Vaclav Kotesovec, Aug 09 2013
D-finite with recurrence: 2*n*(2*n-1)*(n-1)*a(n) -(n-1)*(19*n^2-60*n+48)*a(n-1) +(-31*n^3+173*n^2-346*n+264)*a(n-2) +4*(2*n-7)*(17*n^2-83*n+102)*a(n-3) +36*(2*n-7)*(2*n-9)*(n-4)*a(n-4)=0. - R. J. Mathar, Feb 20 2020
a(n) + A111160(n) = A000108(n). - F. Chapoton, Jul 14 2021

Extensions

a(0)=0 prepended by Alois P. Heinz, Mar 04 2019

A205341 T(n,k)=Number of length n+1 nonnegative integer arrays starting and ending with 0 with adjacent elements unequal but differing by no more than k.

Original entry on oeis.org

0, 0, 1, 0, 2, 0, 0, 3, 2, 2, 0, 4, 6, 11, 0, 0, 5, 12, 35, 24, 5, 0, 6, 20, 82, 138, 93, 0, 0, 7, 30, 160, 454, 689, 272, 14, 0, 8, 42, 277, 1130, 2912, 3272, 971, 0, 0, 9, 56, 441, 2370, 8927, 18652, 16522, 3194, 42, 0, 10, 72, 660, 4424, 22297, 71630, 124299, 83792, 11293, 0, 0
Offset: 1

Views

Author

R. H. Hardin, Jan 26 2012

Keywords

Comments

Table starts
..0...0.....0......0......0.......0.......0........0........0........0
..1...2.....3......4......5.......6.......7........8........9.......10
..0...2.....6.....12.....20......30......42.......56.......72.......90
..2..11....35.....82....160.....277.....441......660......942.....1295
..0..24...138....454...1130....2370....4424.....7588....12204....18660
..5..93...689...2912...8927...22297...48335....94456...170529...289229
..0.272..3272..18652..71630..214724..542850..1211784..2459988..4633800
.14.971.16522.124299.594405.2133784.6285127.16018970.36557640.76469705

Examples

			Some solutions for n=5, k=3:
..0....0....0....0....0....0....0....0....0....0....0....0....0....0....0....0
..2....2....2....2....3....2....1....2....2....2....2....2....1....3....2....3
..4....5....4....0....2....4....4....4....1....4....3....1....2....5....5....5
..6....4....3....1....4....1....2....2....0....1....0....2....4....4....4....4
..3....3....2....3....1....2....1....3....3....3....2....3....2....2....2....1
..0....0....0....0....0....0....0....0....0....0....0....0....0....0....0....0
		

Crossrefs

Column 1 odd n is A000108((n+5)/2).
Column 2 is A187430.
Row 3 is A002378(n-1).

Programs

  • Mathematica
    T[n_, m_] := T[n, m] = If[n == 0, 1, 1/(n)*Sum[Sum[Binomial[i, l]*(-1)^l* Sum[(-1)^j*Binomial[i-l, j]*Binomial[(-l - 2*j + i)*m - l - j + i - 1, (-l - 2*j + i)*m-j], {j, 0, (i-l)*m/(2*m+1)}], {l, 0, i}]*T[n-i, m], {i, 1, n}]];
    Table[T[n-m+1, m], {n, 1, 11}, {m, n, 1, -1}] // Flatten (* Jean-François Alcover, Sep 24 2019, after Vladimir Kruchinin *)
  • Maxima
    T(n,m):=if n=0 then 1 else 1/(n)*sum(sum(binomial(i,l)*(-1)^l*sum((-1)^j*binomial(i-l,j)*binomial((-l-2*j+i)*m-l-j+i-1,(-l-2*j+i)*m-j),j,0,(i-l)*m/(2*m+1)),l,0,i)*T(n-i,m),i,1,n); /* Vladimir Kruchinin, Apr 07 2017 */

Formula

Empirical for row n:
n=2: T(2,k) = k
n=3: T(3,k) = k^2 - k
n=4: T(4,k) = (4/3)*k^3 - (1/2)*k^2 + (7/6)*k
n=5: T(5,k) = (23/12)*k^4 - (1/2)*k^3 + (1/12)*k^2 - (3/2)*k
n=6: T(6,k) = (44/15)*k^5 - (5/12)*k^4 + (5/12)*k^2 + (31/15)*k
n=7: T(7,k) = (841/180)*k^6 - (1/3)*k^5 - (19/36)*k^4 + (1/3)*k^3 - (103/90)*k^2 - 3*k
T(n,m) = 1/n*Sum_{i=1..n} (Sum_{,l,0,i} (binomial(i,l)*(-1)^l *Sum_{j=0..(i-l)* m/(2*m+1)}((-1)^j*binomial(i-l,j)*binomial((-l-2*j+i)*m-l-j+i-1,(-l-2*j+i)*m-j)))*T(n-i,m)), T(0,m)=1. - Vladimir Kruchinin, Apr 07 2017

A092765 Consider the 1-D random walk with jumps to next-nearest neighbors. Sequence gives number of paths of length n ending at origin.

Original entry on oeis.org

1, 0, 4, 6, 36, 100, 430, 1470, 5796, 21336, 82404, 312180, 1203246, 4617756, 17846686, 68974906, 267498660, 1038555024, 4040525320, 15739195680, 61399048036, 239788778760, 937536139764, 3669179504364, 14373144873774, 56350223472600, 221094286028100
Offset: 0

Views

Author

Sergey Perepechko, Apr 19 2004

Keywords

Comments

In Lakatos-Lindenberg and Shuler besides some physical background there is an exact algebraic expression for the generating function.
Examples from Banderier and Flajolet deal with constrained walks ("meanders" and "excursions") while this sequence counts unrestricted paths.
Logarithmic derivative of A187430 (when offset 1). - Paul D. Hanna, May 31 2015

Examples

			a(3)=6 because 0=+2-1-1, 0=-2+1+1, 0=-1-1+2, 0=+1+1-2, 0=+1-2+1, 0=-1+2-1.
		

Crossrefs

Programs

  • Maple
    a:=array(0..20):a[0]:=1:a[1]:=0:a[2]:=4:for n from 2 to 19 do a[n+1]:=(-n*(17*n-43)*a[n]+(78*n^2-66*n+36)*a[n-1]+(216*n^2-540*n+324)*a[n-2])/(2*(n+1)*(2*n+1)):print(n+1,a[n+1]) od:
    seq(coeff( (t^2+t+1/t+1/t^2)^n, t, 0), n=0..24);   # Mark van Hoeij, May 20 2013
  • Mathematica
    a[n_] := Binomial[4n, 2n]*Hypergeometric2F1[-2n, -n, 1/2 - 2n, 3/4]; Table[a[n], {n, 0, 24}] (* Jean-François Alcover, Nov 22 2012 *)
  • PARI
    a(n) = sum(k=0,n,binomial(n,k)*binomial(4*n-2*k,2*n-k)*(-3)^k)  /* Max Alekseyev, Apr 19 2006 */
    
  • PARI
    a(n)=sum(k=0,n,binomial(n,k)*binomial(n,2*n-3*k))  /* Max Alekseyev, Feb 08 2008 */
    
  • PARI
    a(n)=sum(k=0,2*n,(-1)^k*binomial(2*n,k)*polcoeff((1+x+x^2)^n,k))  /* Paul D. Hanna, Nov 30 2009 */
    
  • PARI
    a(n) = polcoeff(( (1-x)*(1-x^3) + O(x^(2*n+1)) )^n, 2*n); /* Max Alekseyev, Jun 01 2015 */

Formula

G.f. in Maple notation: {x*(1+6*x)*(1-4*x)*(4+9*x)*diff(G(x), x, x)=2*(270*x^3+84*x^2+13*x-1)*diff(G(x), x)+4*x*(12+27*x)*G(x), G(0)=1, D(G)(0)=0} rec; 2*(n+1)*(2*n+1)*a(n+1)+n*(17*n-43)*a(n)=(78*n^2-66*n+36)*a(n-1)+(216*n^2-540*n+324)*a(n-2).
GFun gives the following algebraic equation for generating function: x+2*(1-4*x)*(3*x-2)*g(x)^2+(1-4*x)^2*(9*x+4)*g(x)^4=0. - Sergey Perepechko, Sep 06 2004
a(n) = (2^(2n+1) / Pi) * Integral(cos(t)^n*cos(3*t)^n, t=0..Pi/2); a(n) = Sum_{k=0..n} binomial(n,k)*binomial(4*n-2*k,2*n-k)*(-3)^k. G.f.: (1 + sqrt(1-4*x)) / ( sqrt(1-4*x) * ( sqrt(1+6*x+2*sqrt(9*x^2+4*x)) + sqrt(1+6*x-2*sqrt(9*x^2+4*x)) ) ). - Max Alekseyev, Apr 19 2006
a(n) = Sum_{k=0..n} binomial(n,k)*binomial(n,2*n-3*k). - Max Alekseyev, Feb 08 2008
a(n) = Sum_{k=0..2n} (-1)^k*binomial(2n,k)*A027907(n,k) where A027907 is the triangle of trinomial coefficients. - Paul D. Hanna, Nov 30 2009
a(n) = ((n-1)*(35*n^2-49*n+12) *a(n-1) +18*(n-1)*(2*n-3)*(5*n-2) *a(n-2)) / (2*n*(2*n-1)*(5*n-7)) for n>=2, a(n) = 1-n for n<2. - Alois P. Heinz, May 20 2013
a(n) ~ 4^n / sqrt(5*Pi*n). - Vaclav Kotesovec, Sep 12 2014
a(n) is the coefficient of x^(2*n) in ((1-x)*(1-x^3))^n. - Max Alekseyev, Jun 01 2015
a(n) = (-1)^n*binomial(2*n,n)*hypergeom([-n,n/2,(n+1)/2],[n,n+1],4). - Peter Luschny, Nov 02 2016
From Peter Bala, Feb 08 2022: (Start)
a(n) = Sum_{k = 0..n} (-1)^k*binomial(2*n,k)*binomial(3*n-2*k-1,n-k).
a(n) = Sum_{k = 0..floor(n/2)} binomial(2*n,k)*binomial(n-k-1,n-2*k).
a(n) = [x^n] ((1 - x + x^2)/(1 - x))^(2*n).
The Gauss congruences a(n*p^k) == a(n*p^(k-1)) ( mod p^k ) hold for any prime p and positive integers n and k.
Conjecture: the stronger congruences a(n*p^k) == a(n*p^(k-1)) ( mod p^(2*k) ) hold for any prime p, except p = 3, and positive integers n and k.(End)

Extensions

More terms from Max Alekseyev, Apr 19 2006

A111160 G.f.: C - Z; where C is the g.f. for the Catalan numbers (A000108) and Z is the g.f. for A055113 with offset 0.

Original entry on oeis.org

0, 1, 1, 4, 9, 31, 91, 309, 1009, 3481, 11956, 42065, 148655, 532039, 1915369, 6950452, 25357233, 93034813, 342888250, 1269246437, 4715945712, 17583623988, 65766726906, 246694006971, 927801717255, 3497918129001, 13217196871126, 50046561077947
Offset: 0

Views

Author

N. J. A. Sloane, Oct 22 2005

Keywords

Comments

Expressible in terms of ballot numbers.
Number of positive walks with n steps {-2,-1,1,2} starting at the origin, ending at altitude 2, and staying strictly above the x-axis. - David Nguyen, Dec 16 2016

Crossrefs

Programs

  • Magma
    I:=[1,1,4]; [0] cat [n le 3 select I[n] else (n*(115*n^3 - 344*n^2 + 299*n - 82)*Self(n-1) + 4*(2*n-3)*(5*n^3 + 27*n^2 - 74*n + 30)*Self(n-2) - 36*(n-2)*(2*n-5)*(2*n-3)*(5*n-3)*Self(n-3))/(2*n*(n+1)*(2*n+1)*(5*n-8)): n in [1..30]]; // Vincenzo Librandi, Oct 06 2015
  • Maple
    a := n -> (-1)^(n+1)*binomial(2*n+1,n)*hypergeom([-n-1,n/2+1/2,n/2],[n,n+1],4)/ (2*n+1);
    [0, op([seq(round(evalf(a(n),32)), n=1..27)])]; # Peter Luschny, Oct 06 2015
  • Mathematica
    CoefficientList[ Series[ -((-3 + Sqrt[1 - 4*x] + Sqrt[2]*Sqrt[1 + Sqrt[1 - 4x] + 6x])/(4x)), {x, 0, 10}], x] (* Robert G. Wilson v *)
  • PARI
    a(n) = if(n==0, 0, sum(k=0, (n+1)/2, binomial(n-k,n-2*k+1)*binomial(2*n+1,k))/(2*n+1)); \\ Altug Alkan, Oct 05 2015
    

Formula

Let C := (1 - sqrt(1 - 4*x)) / (2*x), Z := (- 1/4 - (1/4)*(1 - 4*x)^(1/2) + (1/4)*(2 + 2*(1 - 4*x)^(1/2) + 12*x)^(1/2))/x; g.f. is W := C - Z.
G.f.: -((-3 + sqrt(1 - 4x) + sqrt(2)*sqrt(1 + sqrt(1 - 4x) + 6x))/(4x)).
a(n) = sum(j=0..n+1, binomial(n+2*j-1,j)*(-1)^(n+j+1)*binomial(2*n+1,j+n))/(2*n+1). [Vladimir Kruchinin, Feb 15 2013]
a(n) ~ (1+1/sqrt(5))*2^(2*n-1)/(sqrt(Pi)*n^(3/2)). - Vaclav Kotesovec, Aug 13 2013
Recurrence: 2*n*(n+1)*(2*n+1)*(5*n-8)*a(n) = n*(115*n^3 - 344*n^2 + 299*n - 82)*a(n-1) + 4*(2*n-3)*(5*n^3 + 27*n^2 - 74*n + 30)*a(n-2) - 36*(n-2)*(2*n-5)*(2*n-3)*(5*n-3)*a(n-3). - Vaclav Kotesovec, Aug 13 2013
a(n) = Sum_{j=0..(n+1)/2}(binomial(n-j,n-2*j+1)*binomial(2*n+1,j))/(2*n+1). - Vladimir Kruchinin, Oct 05 2015
a(n) = (-1)^(n+1)*C(2*n+1,n)*hypergeom([-n-1,n/2+1/2,n/2],[n,n+1],4)/(2*n+1) for n>0. - Peter Luschny, Oct 06 2015

A185286 Triangle T(n,k) is the number of nonnegative walks of n steps with step sizes 1 and 2, starting at 0 and ending at k.

Original entry on oeis.org

1, 0, 1, 1, 2, 1, 1, 2, 1, 2, 5, 6, 3, 3, 3, 1, 11, 11, 13, 17, 13, 7, 6, 4, 1, 24, 41, 52, 44, 43, 40, 25, 14, 10, 5, 1, 93, 120, 152, 176, 161, 126, 107, 80, 45, 25, 15, 6, 1, 272, 421, 550, 559, 561, 524, 412, 303, 227, 146, 77, 41, 21, 7, 1, 971, 1381, 1813, 2056, 2045, 1835, 1615, 1309, 938, 648, 435, 251, 126, 63, 28, 8, 1
Offset: 0

Views

Author

Keywords

Comments

Equivalently, the number of paths from (0,0) to (n,k) using steps of the form (1,2),(1,1),(1,-1) or (1,-2) and staying on or above the x-axis.
It appears that A047002 gives the row sums of this triangle.

Examples

			The table starts:
1
0,1,1
2,1,1,2,1
2,5,6,3,3,3,1
		

Crossrefs

Columns k=0..2 are A187430, A055113, A296619.
Cf. A005408(row lengths), A047002(apparently row sums).

Programs

  • Maple
    T:= proc(n,k) option remember;
      if k < 0 or k > 2*n then return 0 fi;
      procname(n-1,k-2)+procname(n-1,k-1)+procname(n-1,k+1)+procname(n-1,k+2)
    end proc:
    T(0,0):= 1:
    for nn from 0 to 10 do
      seq(T(nn,k),k=0..2*nn)
    od; # Robert Israel, Dec 19 2017
  • Mathematica
    T[n_, k_] := T[n, k] = If[k < 0 || k > 2n, 0, T[n-1, k-2] + T[n-1, k-1] + T[n-1, k+1] + T[n-1, k+2]];
    T[0, 0] = 1;
    Table[T[n, k], {n, 0, 10}, {k, 0, 2n}] // Flatten (* Jean-François Alcover, Aug 19 2022, after Robert Israel *)
  • PARI
    flip(v)=vector(#v,i,v[#v+1-i])
    ar(n)={local(p);p=1;
    for(k=1,n,p*=1+x+x^3+x^4;p=(p-polcoeff(p,0)-polcoeff(p,1)*x)/x^2);
    flip(Vec(p))}

A296619 The number of nonnegative walks of n steps with step sizes 1 and 2, starting at 0 and ending at 2.

Original entry on oeis.org

0, 1, 1, 6, 13, 52, 152, 550, 1813, 6453, 22427, 80330, 286895, 1038931, 3772801, 13807294, 50726893, 187332517, 694364517, 2583714636, 9644852364, 36115537269, 135607526865, 510496492338, 1926284451923, 7284476707597, 27602839227883, 104791979218326
Offset: 0

Views

Author

Feng Jishe, Dec 17 2017

Keywords

Comments

a(n) is the number of 2-D walks with n steps of type {(1,-2), (1,-1), (1,1), or (1,2)} starting at (0,0), ending at (n,2), and not dropping below the x-axis.
The sequence corresponds to element (1,3) of the matrix B(n)^n (see Maple script). Furthermore, element (1,1) of the matrix is A187430, the element (1,2) of these matrix is A055113.

Examples

			There are 6 walks of length 3:
        __
       |  |         __
     __|  |_     __|  |_     __    _
    |           |           |  |__|
   _|          _|          _|
    2+2-2=2     2+1-1=2     2-1+1=2
                    __
     __    _       |  |_           _
    |  |  |      __|         __   |
   _|  |__|    _|          _|  |__|
    2-2+2=2     1+2-1=2     1-1+2=2
		

Crossrefs

Programs

  • Maple
    B := n -> LinearAlgebra:-ToeplitzMatrix([0,1,1, seq(0, k=0..n-2)], symmetric):
    seq((B(n)^n)(1, 3), n=0..27);
    # alternative:
    T:= proc(n,k) option remember;
      if k < 0 or k > 2*n then return 0 fi;
      procname(n-1,k-2)+procname(n-1,k-1)+procname(n-1,k+1)+procname(n-1,k+2)
    end proc:
    T(0,0):= 1:
    seq(T(n,2),n=0..40); # Robert Israel, Dec 19 2017
  • Mathematica
    b[n_] := ToeplitzMatrix[Join[{0,1,1}, ConstantArray[0,n-1]]];
    Prepend[Table[MatrixPower[b[n],n][[1,3]], {n,20}], 0]
    (* Andrey Zabolotskiy, Dec 19 2017 *)
  • PARI
    Next(v)={vector(#v+2, i, if(i<3||i>#v-2, 0, v[i-2]+v[i-1]+v[i+1]+v[i+2]))}
    my(v=vector(7,i,i==3)); for(n=1, 50, print1(v[5],", "); v=Next(v)) \\ Andrew Howroyd, Dec 18 2017

Formula

a(n) = A185286(n,2). - Robert Israel, Dec 19 2017

A122918 Expansion of (1+x)^2/(1+x+x^2)^2.

Original entry on oeis.org

1, 0, -2, 2, 1, -4, 3, 2, -6, 4, 3, -8, 5, 4, -10, 6, 5, -12, 7, 6, -14, 8, 7, -16, 9, 8, -18, 10, 9, -20, 11, 10, -22, 12, 11, -24, 13, 12, -26, 14, 13, -28, 15, 14, -30, 16, 15, -32, 17, 16, -34, 18, 17, -36, 19, 18, -38
Offset: 0

Views

Author

Paul Barry, Sep 19 2006

Keywords

Comments

Row sums of Riordan array (1/(1+x+x^2), x/(1+x)^2), A122917.
For n>=1, a(n) equals (-1)^(n+1) times the second immanant of the n X n matrix with 1's along the main diagonal, superdiagonal, and subdiagonal, and 0's everywhere else. The second immanant of an n X n matrix A is the immanant of A given by the partition (2, 1^(n-2)). - John M. Campbell, Apr 12 2014

Crossrefs

Cf. A187430 (series reversion, with offset 1).

Programs

  • Mathematica
    CoefficientList[Series[(1 + x)^2/(1 + x + x^2)^2, {x, 0, 100}], x] (* Vincenzo Librandi, Apr 13 2014 *)
    Print[Table[(-1)^(n+1)*Sum[Binomial[n-i, i]*(n-2*i-1)*(-1)^i, {i, 0, Floor[n/2]}], {n, 0, 100}]] ;  (* John M. Campbell, Jan 08 2016 *)
  • PARI
    Vec((1+x)^2/(1+x+x^2)^2 + O(x^100)) \\ Altug Alkan, Jan 08 2015
    
  • PARI
    A122918(n)=(-1)^(n+1)*sum(i=0,n\2,(-1)^i*binomial(n-i,i)*(n-2*i-1)) \\ M. F. Hasler, Jan 12 2016

Formula

a(n) = 4 * sqrt(3) * cos(2*Pi*n/3 + Pi/6)/9 + 2(n+1) * sin(2*Pi*n/3 + Pi/6)/3. a(n) = sum{k=0..n} A057078(k) * A057078(n-k).
a(n) = (-1)^(n+1)*sum((-1)^i*binomial(n-i,i)*(n-2*i-1), i=0..[n/2]). - John M. Campbell, Jan 08 2016
Showing 1-8 of 8 results.