A180046 a(n+1) = a(n-3) + a(n-2) - a(n-1) + a(n) starting with 1, 2, 3, 4.
1, 2, 3, 4, 4, 5, 8, 11, 12, 14, 21, 30, 35, 40, 56, 81, 100, 115, 152, 218, 281, 330, 419, 588, 780, 941, 1168, 1595, 2148, 2662, 3277, 4358, 5891, 7472, 9216, 11993, 16140, 20835, 25904, 33202, 44273, 57810, 72643, 92308, 121748, 159893, 203096, 257259
Offset: 1
Examples
1 2 3 4 (by definition); 1 + 2 - 3 + 4 = 4, 2 + 3 - 4 + 4 = 5, 3 + 4 - 4 + 5 = 8.
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).
Crossrefs
Cf. A100329.
Programs
-
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
-
Mathematica
LinearRecurrence[{1,-1,1,1},{1,2,3,4},50] (* Harvey P. Dale, Mar 18 2015 *)
-
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
Formula
G.f.: -x*(1+x)*(2*x^2+1)/(-1+x-x^2+x^3+x^4). - R. J. Mathar, Aug 14 2010
Extensions
More terms from R. J. Mathar, Aug 14 2010
Name edited by Michel Marcus, Feb 20 2025