login
A181716
a(n) = a(n-1) + a(n-2) + (-1)^n, with a(0)=0 and a(1)=1.
4
0, 1, 2, 2, 5, 6, 12, 17, 30, 46, 77, 122, 200, 321, 522, 842, 1365, 2206, 3572, 5777, 9350, 15126, 24477, 39602, 64080, 103681, 167762, 271442, 439205, 710646, 1149852, 1860497, 3010350, 4870846, 7881197, 12752042, 20633240, 33385281, 54018522, 87403802
OFFSET
0,3
COMMENTS
Aside from the first term, duplicate of A098600.
LINKS
Aleksandar Petojević, Marjana Gorjanac Ranitović, Dragan Rastovac, and Milinko Mandić, The Golden Ratio, Factorials, and the Lambert W Function, Journal of Integer Sequences, Vol. 27 (2024), Article 24.5.7. See p. 4.
FORMULA
a(n) = a(n-1) + a(n-2) + (-1)^n.
a(n) = 2*a(n-2) + a(n-3).
a(n) - A000045(n) = A008346(n-2).
G.f.: x*(1+2*x)/(1-2*x^2-x^3). - Colin Barker, Jan 09 2012
a(n) = A000032(n-1) + (-1)^n. - G. C. Greubel, Mar 25 2024
E.g.f.: exp(x/2)*(sqrt(5)*sinh(sqrt(5)*x/2) - cosh(sqrt(5)*x/2)) + exp(-x). - Stefano Spezia, Jun 18 2024
MATHEMATICA
a[0]= 0; a[1]= 1; a[n_]:= a[n]= a[n-1] +a[n-2] +(-1)^n; Array[a, 38, 0]
LinearRecurrence[{0, 2, 1}, {0, 1, 2}, 40] (* Vincenzo Librandi, Jan 09 2012 *)
PROG
(Magma) I:=[0, 1, 2]; [n le 3 select I[n] else 2*Self(n-2)+Self(n-3): n in [1..40]]; // Vincenzo Librandi, Jan 09 2012
(Magma) [Lucas(n-1)+(-1)^n: n in [0..40]]; // G. C. Greubel, Mar 25 2024
(SageMath) [lucas_number2(n-1, 1, -1)+(-1)^n for n in range(41)] # G. C. Greubel, Mar 25 2024
CROSSREFS
First differences of A014217.
Sequence in context: A099926 A355021 A098600 * A261866 A147766 A034420
KEYWORD
easy,nonn
AUTHOR
Robert G. Wilson v, Nov 07 2010
STATUS
approved