OFFSET
0,4
COMMENTS
Variation of Fibonacci sequence.
FORMULA
G.f.: x(1+x+2x^2+4x^3-2x^4+2x^5)/(1-9x^4-2x^8). - Michael Somos, Feb 19 2003
EXAMPLE
a(5)=7 since a(4)=4 then 7=4+2+1.
MATHEMATICA
maxN=10 a[0]=0 a[1]=1 Do[ If[EvenQ[a[i-1]]==True, a[i]=a[i-1]+a[i-2]+a[i-3], a[i]=a[i-1]+a[i-2]]; Print[a[i]], {i, 2, maxN}]
PROG
(PARI) a(n)=if(n<0, 0, polcoeff(x*(1+x+2*x^2+4*x^3-2*x^4+2*x^5)/(1-9*x^4-2*x^8)+x*O(x^n), n))
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Lorenzo Fortunato (fortunat(AT)pd.infn.it), Jan 06 2003
STATUS
approved