login
a(n) = a(n-1) + a(n-2) - a(n-3) + a(n-4) + a(n-5), with a(0)=a(1)=a(2)=1, a(3)=-1 and a(4)=1.
1

%I #21 Jul 11 2024 07:50:30

%S 1,1,1,-1,1,1,5,5,9,11,21,33,57,89,145,231,377,609,989,1597,2585,4179,

%T 6765,10945,17713,28657,46369,75023,121393,196417,317813,514229,

%U 832041,1346267,2178309,3524577,5702889,9227465,14930353,24157815

%N a(n) = a(n-1) + a(n-2) - a(n-3) + a(n-4) + a(n-5), with a(0)=a(1)=a(2)=1, a(3)=-1 and a(4)=1.

%C The array of successive differences begins:

%C 1, 1, 1, -1, 1, 1, 5, 5, 9, 11, 21, 33, 57, ...

%C 0, 0, -2, 2, 0, 4, 0, 4, 2, 10, 12, 24, 32, ...

%C 0, -2, 4, -2, 4, -4, 4, -2, 8, 2, 12, 8, 24, ...

%C -2, 6, -6, 6, -8, 8, -6, 10, -6, 10, -4, 16, 6, ...

%C 8, -12, 12, -14, 16, -14, 16, -16, 16, -14, 20, -10, 24, ...

%C ...

%C First row is a(n) = 2*A141325(n) - A141325(n+1).

%C Main diagonal is A099430(n).

%C The first upper subdiagonal, 1, -2, -2, -8, -14, ..., has -3*A078008(n) as first differences.

%C The second upper subdiagonal is A000079(n) = 2^n.

%C a(n) is related to Fibonacci numbers a(n) = A000045(n-2) + period 6: repeat [2, 0, 1, -2, 0, -1].

%H G. C. Greubel, <a href="/A290968/b290968.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,1,-1,1,1).

%F G.f.: (1-x^2-2*x^3+x^4)/((1+x)*(1-x+x^2)*(1-x-x^2)).

%F a(n) ~ phi^(n-2)/sqrt(5), where phi is the golden ratio.

%F a(n) = (1/2 + sqrt(5)/2)^n*(3*sqrt(5)/10-1/2) - (-1/2 + sqrt(5)/2)^n*(3*sqrt(5)/10 + 1/2)*(-1)^n + 2*sqrt(3)*sin(Pi*(n/3 + 1/3))/3 + (-1)^n. - _Eric Simon Jacob_, Jul 11 2024

%t LinearRecurrence[{1,1,-1,1,1}, {1,1,1,-1,1}, 40]

%o (PARI) my(x='x+O('x^40)); Vec((1-x^2-2*x^3+x^4)/((1+x^3)*(1-x-x^2))) \\ _G. C. Greubel_, Jun 11 2019

%o (Magma) R<x>:=PowerSeriesRing(Integers(), 40); Coefficients(R!( (1-x^2-2*x^3+x^4)/((1+x^3)*(1-x-x^2)) )); // _G. C. Greubel_, Jun 11 2019

%o (Sage) ((1-x^2-2*x^3+x^4)/((1+x^3)*(1-x-x^2))).series(x, 40).coefficients(x, sparse=False) # _G. C. Greubel_, Jun 11 2019

%Y Cf. A000045, A078008, A099430, A131531, A141325.

%K easy,sign

%O 0,7

%A _Jean-François Alcover_ and _Paul Curtz_, Aug 16 2017