OFFSET
1,3
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,1,1,-1,-1).
FORMULA
a(n) = floor(C*F(n)) + b(n) where C=(9-sqrt(5))/4, F(n) is the n-th Fibonacci number and b(n) is the 6-periodic sequence (0, 0, -1, -1, 0, -1).
G.f.: (1 + 2*x^4)/((1-x^3)*(1-x-x^2)).
a(1)=1, a(2)=1, a(3)=2, a(4)=4, a(5)=8, a(n) = a(n-1) +a(n-2) +a(n-3) - a(n-4) -a(n-5). - Harvey P. Dale, Feb 01 2013
MAPLE
seq(coeff(series((1+2*x^4)/((1-x^3)*(1-x-x^2)), x, n+1), x, n), n = 0 .. 40); # G. C. Greubel, Aug 15 2019
MATHEMATICA
RecurrenceTable[{a[1]==a[2]==1, a[n]==a[n-1]+a[n-2]+Mod[n, 3]}, a, {n, 40}] (* or *) LinearRecurrence[{1, 1, 1, -1, -1}, {1, 1, 2, 4, 8}, 40] (* Harvey P. Dale, Feb 01 2013 *)
PROG
(PARI) my(x='x+O('x^40)); Vec((1+2*x^4)/((1-x^3)*(1-x-x^2))) \\ G. C. Greubel, Aug 15 2019
(Magma) R<x>:=PowerSeriesRing(Integers(), 40); Coefficients(R!( (1+2*x^4)/((1-x^3)*(1-x-x^2)) )); // G. C. Greubel, Aug 15 2019
(Sage)
def A081410_list(prec):
P.<x> = PowerSeriesRing(ZZ, prec)
return P((1+2*x^4)/((1-x^3)*(1-x-x^2))).list()
A081410_list(30) # G. C. Greubel, Aug 15 2019
(GAP) a:=[1, 1, 2, 4, 8];; for n in [6..40] do a[n]:=a[n-1]+a[n-2]+a[n-3] -a[n-4]-a[n-5]; od; a; # G. C. Greubel, Aug 15 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Apr 20 2003
STATUS
approved