OFFSET
0,4
COMMENTS
Every third iteration is a tribonacci-type recursion: a(n) = a(n-1) + a(n-3) otherwise it is Fibonacci-type a(n) = a(n-1) + a(n-2).
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..1000
Russell Walsmith, Fibonacci-Tribonacci Fusion
Index entries for linear recurrences with constant coefficients, signature (0,0,4,0,0,-1).
FORMULA
Two identities: a(3n)/2 + a(3n-3)/2 = a(3n-1); a(3n)/2 - a(3n-3)/2 = a(3n-2).
G.f.: x * (1 + x + 2*x^2 - x^3 + x^4) / (1 - 4*x^3 + x^6). - Michael Somos, Feb 23 2015
0 = a(n) - 4*a(n+3) + a(n+6) for all n in Z. - Michael Somos, Feb 23 2015
EXAMPLE
For n = 7, a(n-1) is even so 8 + 3 = 11.
G.f. = x + x^2 + 2*x^3 + 3*x^4 + 5*x^5 + 8*x^6 + 11*x^7 + 19*x^8 + 30*x^9 + ...
MATHEMATICA
CoefficientList[Series[x*(1+x+2*x^2-x^3+x^4)/(1-4*x^3+x^6), {x, 0, 60}], x] (* G. C. Greubel, Aug 03 2018 *)
nxt[{a_, b_, c_}]:={b, c, If[OddQ[c], c+b, c+a]}; NestList[nxt, {0, 1, 1}, 50][[All, 1]] (* or *) LinearRecurrence[{0, 0, 4, 0, 0, -1}, {0, 1, 1, 2, 3, 5}, 50] (* Harvey P. Dale, May 12 2022 *)
PROG
(PARI) {a(n) = polcoeff( x * if( n<0, n=-n; -(1 - x + 2*x^2 + x^3 + x^4), (1 + x + 2*x^2 - x^3 + x^4)) / (1 - 4*x^3 + x^6) + x * O(x^n), n)}; /* Michael Somos, Feb 23 2015 */
(Haskell)
a254308 n = a254308_list !! n
a254308_list = 0 : 1 : 1 : zipWith3 (\u v w -> u + if odd u then v else w)
(drop 2 a254308_list) (tail a254308_list) a254308_list
-- Reinhard Zumkeller, Feb 24 2015
(Magma) m:=60; R<x>:=PowerSeriesRing(Integers(), m); [0] cat Coefficients(R!(x*(1+x+2*x^2-x^3+x^4)/(1-4*x^3+x^6))); // G. C. Greubel, Aug 03 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Russell Walsmith, Feb 23 2015
STATUS
approved