OFFSET
0,4
COMMENTS
Let F(x) = product {n >= 0} (1 - x^(3*n+1))/(1 - x^(3*n+2)). This sequence is the simple continued fraction expansion of the real number F(1/2) = 0.64227 25013 85234 96714 ... = 1/(1 + 1/(1 + 1/(1 + 1/(3 + 1/(1 + 1/(7 + 1/(1 + 1/(15 + ...)))))))). See A111317. - Peter Bala, Dec 26 2012
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..5000
Index entries for linear recurrences with constant coefficients, signature (-1,2,2).
FORMULA
G.f.: (1+2*x) / ((1+x) * (1-2*x^2)).
E.g.f.: exp(-x) + 2*sinh(sqrt(2)*x) / sqrt(2).
a(n) = (-1)^n + ((sqrt(2))^n - (-sqrt(2))^n) / sqrt(2).
a(n) = (1-(-1)^n) * 2^floor(n/2) + (-1)^n. - Ralf Stephan, Aug 19 2013
a(n) = -a(n-1) + 2*a(n-2) + 2*a(n-3). - Andrew Howroyd, Feb 21 2018
MATHEMATICA
LinearRecurrence[{-1, 2, 2}, {1, 1, 1}, 60] (* Jean-François Alcover, Jul 02 2018 *)
PROG
(Magma) [Ceiling((-1)^n+((Sqrt(2))^n-(-Sqrt(2))^n)/Sqrt(2)): n in [0..50]]; // Vincenzo Librandi, Aug 17 2011
(PARI) a(n)=(1-(-1)^n)*2^floor(n/2)+(-1)^n
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Apr 22 2004
EXTENSIONS
Better name from Ralf Stephan, Aug 19 2013
Even terms for n >= 60 corrected in b-file by Andrew Howroyd, Feb 21 2018
STATUS
approved