OFFSET
1,2
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = a(n-1) + 1 for n mod 3 == 2;
a(n) = a(n-1) + 2 for n mod 3 == 0;
a(n) = a(n-1) + a(n-2) + a(n-3) for n mod 3 == 1 and n > 1.
G.f.: x*(1 + 2*x + 4*x^2 + 3*x^3 - 6*x^5)/((1 - x)*(1 + x + x^2)*(1 - 3*x^3)). - Andrew Howroyd, Apr 13 2021
PROG
(PARI) seq(n)={my(a=vector(n)); a[1]=1; for(n=2, #a, my(t=n%3); a[n]=a[n-1]+if(t==2, 1, if(t==0, 2, a[n-2]+a[n-3]))); a} \\ Andrew Howroyd, Apr 13 2021
(PARI) Vec((1 + 2*x + 4*x^2 + 3*x^3 - 6*x^5)/((1 - x)*(1 + x + x^2)*(1 - 3*x^3)) + O(x^40)) \\ Andrew Howroyd, Apr 13 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Chris Rice (cwrice(AT)research.att.com), Oct 27 2009
STATUS
approved