OFFSET
1,2
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,1,-1).
FORMULA
G.f.: x*(1+2*x+5*x^2)/((1+x)*(1-x)^2). - Paul Barry, Apr 10 2008
a(n) = 4*(n-1)-(-1)^n. - Rolf Pleisch, Aug 04 2009
a(n) = 8*n-a(n-1)-12, with a(1)=1. - Vincenzo Librandi, Aug 06 2010
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/8 + sqrt(2)*log(sqrt(2)+1)/4. - Amiram Eldar, Dec 18 2021
EXAMPLE
For n=2, a(2) = 8*2-1-12 = 3;
For n=3, a(3) = 8*3-3-12 = 9;
For n=4, a(4) = 8*4-9-12 = 11. - Vincenzo Librandi, Aug 06 2010
MAPLE
MATHEMATICA
Table[4 n - 4 - (-1)^n, {n, 100}] (* Wesley Ivan Hurt, Jan 30 2014 *)
#+{1, 3}&/@(8*Range[0, 30])//Flatten (* or *) LinearRecurrence[{1, 1, -1}, {1, 3, 9}, 60] (* Harvey P. Dale, Jan 05 2017 *)
PROG
(Haskell)
a047471 n = a047471_list !! (n-1)
a047471_list = [n | n <- [1..], mod n 8 `elem` [1, 3]]
-- Reinhard Zumkeller, Dec 29 2012
(Magma) [4*(n-1)-(-1)^n : n in [1..80]]; // Wesley Ivan Hurt, Apr 28 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
EXTENSIONS
More terms from Vincenzo Librandi, Aug 06 2010
STATUS
approved