A062112 a(0)=0; a(1)=1; a(n) = a(n-1) + (3 + (-1)^n)*a(n-2)/2.
0, 1, 1, 2, 4, 6, 14, 20, 48, 68, 164, 232, 560, 792, 1912, 2704, 6528, 9232, 22288, 31520, 76096, 107616, 259808, 367424, 887040, 1254464, 3028544, 4283008, 10340096, 14623104, 35303296, 49926400, 120532992, 170459392, 411525376
Offset: 0
Examples
a(4) = a(3) + 2*a(2) = 2 + 2 = 4.
Links
- Harry J. Smith, Table of n, a(n) for n = 0..200
- Sean A. Irvine, Walks on Graphs.
- Index entries for linear recurrences with constant coefficients, signature (0, 4, 0, -2).
Programs
-
Magma
m:=30; R
:=PowerSeriesRing(Integers(), m); Coefficients(R!(x*(1+x-2*x^2)/(1-4*x^2+2*x^4))); // G. C. Greubel, Oct 16 2018 -
Mathematica
RecurrenceTable[{a[0]==0,a[1]==1,a[n]==a[n-1]+(3+(-1)^n) (a[n-2])/2},a,{n,40}] (* or *) LinearRecurrence[{0,4,0,-2},{0,1,1,2},40] (* Harvey P. Dale, May 24 2013 *)
-
PARI
{ for (n=0, 200, if (n>1, a=a1 + (3 + (-1)^n)*a2/2; a2=a1; a1=a, if (n==0, a=a2=0, a=a1=1)); write("b062112.txt", n, " ", a) ) } \\ Harry J. Smith, Aug 01 2009
Formula
a(2*n) = A007070(n+1).
a(2*n+1) = A006012(n).
G.f.: x*(1+x-2*x^2)/(1-4*x^2+2*x^4).
a(n) = 4*a(n-2) - 2*a(n-4), a(0)=0, a(1)=1, a(2)=1, a(3)=2. - Harvey P. Dale, May 24 2013