login
A081410
a(n) = a(n-1) + a(n-2) + n (mod 3), with a(1)=a(2)=1.
2
1, 1, 2, 4, 8, 12, 21, 35, 56, 92, 150, 242, 393, 637, 1030, 1668, 2700, 4368, 7069, 11439, 18508, 29948, 48458, 78406, 126865, 205273, 332138, 537412, 869552, 1406964, 2276517, 3683483, 5960000, 9643484, 15603486, 25246970, 40850457
OFFSET
1,3
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
Cf. A004695.
Sequence in context: A095352 A076651 A368986 * A217694 A027677 A103787
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Apr 20 2003
STATUS
approved