OFFSET
0,4
LINKS
Harry J. Smith, Table of n, a(n) for n = 0..200
Index entries for linear recurrences with constant coefficients, signature (0, 4, 0, -2).
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
EXAMPLE
a(4) = a(3) + 2*a(2) = 2 + 2 = 4.
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 *)
PROG
(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
(Magma) m:=30; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!(x*(1+x-2*x^2)/(1-4*x^2+2*x^4))); // G. C. Greubel, Oct 16 2018
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Olivier Gérard, Jun 05 2001
STATUS
approved