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,1).
FORMULA
G.f. -x*(1+x)*(2*x^2+1)/(-1+x-x^2+x^3+x^4). - R. J. Mathar, Aug 14 2010
EXAMPLE
1 2 3 4 (by definition); 1 + 2 - 3 + 4 = 4, 2 + 3 - 4 + 4 = 5, 3 + 4 - 4 + 5 = 8.
MATHEMATICA
LinearRecurrence[{1, -1, 1, 1}, {1, 2, 3, 4}, 50] (* Harvey P. Dale, Mar 18 2015 *)
PROG
(PARI) Vec(x*(1+x)*(2*x^2+1)/(1-x+x^2-x^3-x^4)+O(x^99)) \\ Charles R Greathouse IV, Jul 06 2011
(Haskell)
import Data.List (zipWith4)
a180046 n = a180046_list !! (n-1)
a180046_list = [1..4] ++ zipWith4 (((((+) .) . (+)) .) . (-))
(drop 3 a180046_list) (drop 2 a180046_list)
(tail a180046_list) a180046_list
-- Reinhard Zumkeller, Oct 08 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Ian Stewart, Aug 08 2010
EXTENSIONS
More terms from R. J. Mathar, Aug 14 2010
STATUS
approved