A081410 a(n) = a(n-1) + a(n-2) + n (mod 3), with a(1)=a(2)=1.
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
Keywords
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).
Crossrefs
Cf. A004695.
Programs
-
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
-
Magma
R
:=PowerSeriesRing(Integers(), 40); Coefficients(R!( (1+2*x^4)/((1-x^3)*(1-x-x^2)) )); // G. C. Greubel, Aug 15 2019 -
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 *)
-
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
-
Sage
def A081410_list(prec): P.
= 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
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