I think that the following direct formula follows from this: a(n) = (4/3-2/7*sqrt(21))*((5+sqrt(21))/2)^n +(4/3+2/7*sqrt(21))*((5-sqrt(21))/2)^n + 1/3 Floor.