login
a(n) = -a(n-1) + a(n-2) - F(-n) + 1, a(0) = 1, a(1) = -1, where F() = Fibonacci numbers A000045.
4

%I #31 Jul 24 2022 10:43:33

%S 1,-1,4,-6,14,-24,47,-83,152,-268,476,-832,1453,-2517,4348,-7474,

%T 12810,-21880,37275,-63335,107376,-181656,306744,-517056,870169,

%U -1462249,2453812,-4112478,6884102,-11510808,19226951,-32084027,53489288,-89097892,148290068

%N a(n) = -a(n-1) + a(n-2) - F(-n) + 1, a(0) = 1, a(1) = -1, where F() = Fibonacci numbers A000045.

%H Vincenzo Librandi, <a href="/A175722/b175722.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,3,1,-3,1).

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

%F G.f.: 1 / ((1 - x) * (1 + x - x^2)^2). - _Michael Somos_, Mar 11 2014

%F a(n) = A006478(-2-n) for all n in Z. - _Michael Somos_, Mar 11 2014

%F a(n) = 1 + (-1)^n*(n*Lucas(n+1) + 7*Fibonacci(n))/5. - _G. C. Greubel_, Dec 04 2019

%F E.g.f.: exp(-x/2)*(25*exp(3*x/2) - 15*x*cosh(sqrt(5)*x/2) + sqrt(5)*(5*x - 14)*sinh(sqrt(5)*x/2))/25. - _Stefano Spezia_, Jul 24 2022

%e G.f. = 1 - x + 4*x^2 - 6*x^3 + 14*x^4 - 24*x^5 + 47*x^6 - 83*x^7 + 152*x^8 + ...

%p with(combinat); seq( 1 + (-1)^n*(n*fibonacci(n+2) + (n+7)*fibonacci(n))/5, n=0..40); # _G. C. Greubel_, Dec 04 2019

%t f[x_, m_] = ExpandAll[(x -x^(m+1))*(1-x-x^2) -(1 -2*x +x^(m+1))];

%t g[x_, n_] = ExpandAll[x^(m + 3)*f[1/x, m]];

%t a = Table[Table[SeriesCoefficient[Series[1/g[x, m], {x, 0, 20}], n], {n, 0, 20}], {m, 1, 20}]

%t CoefficientList[Series[1/((1-x)(1+x-x^2)^2), {x, 0, 40}], x] (* _Vincenzo Librandi_, Mar 13 2014 *)

%t RecurrenceTable[{a[0]==1,a[1]==-1,a[n]==-a[n-1]+a[n-2]-Fibonacci[-n]+1},a,{n,40}] (* _Harvey P. Dale_, May 12 2018 *)

%t Table[1 + (-1)^n*(n*LucasL[n+1] + 7*Fibonacci[n])/5, {n,0,40}] (* _G. C. Greubel_, Dec 04 2019 *)

%o (PARI) {a(n) = if( n<0, polcoeff( x^5 / ((1 - x) * (1 - x - x^2)^2) + x * O(x^-n), -n), polcoeff( 1 / ((1 - x) * (1 + x - x^2)^2) + x * O(x^n), n))}; /* _Michael Somos_, Mar 11 2014 */

%o (PARI) vector(41, n, my(f=fibonacci); 1 -(-1)^n*((n-1)*f(n+1) +(n+6)*f(n-1))/5 ) \\ _G. C. Greubel_, Dec 04 2019

%o (Magma) m:=50; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!(1/((1-x)*(1+x-x^2)^2))); // _G. C. Greubel_, Aug 14 2018

%o (Sage) [1 + (-1)^n*(n*lucas_number2(n+1, 1,-1) + 7*fibonacci(n))/5 for n in (0..40)] # _G. C. Greubel_, Dec 04 2019

%o (GAP) List([0..40], n-> 1 + (-1)^n*(n*Lucas(1,-1,n+1)[2] + 7*Fibonacci(n))/5 ); # _G. C. Greubel_, Dec 04 2019

%Y Cf. m=1: A077899, m large: A077925.

%Y Cf. A000032, A000045, A006478.

%K sign,easy

%O 0,3

%A _Roger L. Bagula_, Dec 04 2010