login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A078039 Expansion of (1 - x)/(1 + x - 2*x^2 + x^3). 15

%I #29 Jan 29 2023 06:01:32

%S 1,-2,4,-9,19,-41,88,-189,406,-872,1873,-4023,8641,-18560,39865,

%T -85626,183916,-395033,848491,-1822473,3914488,-8407925,18059374,

%U -38789712,83316385,-178955183,384377665,-825604416,1773314929,-3808901426,8181135700,-17572253481,37743426307,-81069068969

%N Expansion of (1 - x)/(1 + x - 2*x^2 + x^3).

%C The repeated substitution 0 -> {0,1,2}, 1 -> {0,1,2,3}, 2 -> {0,1}, 3 -> {0,1,2}, starting on list {0} and flattening at each step { {sequence1}, {sequence2}, ...} to {sequence1, sequence2, ...} generates a list after n steps with length = a(n). - _Wouter Meeussen_, Mar 06 2004

%C Sequence is identical to its second differences negated, minus the first 3 terms. - _Paul Curtz_, Feb 10 2008

%H G. C. Greubel, <a href="/A078039/b078039.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (-1,2,-1).

%F a(n) = -a(n-1) + 2*a(n-2) - a(n-3). - _Paul Curtz_, Feb 10 2008

%F a(n) = (-1)^n * (A002478(n) + A002478(n+1)). - _Ralf Stephan_, Aug 19 2013

%t LinearRecurrence[{-1,2,-1}, {1,-2,4}, 41] (* _G. C. Greubel_, Jan 24 2023 *)

%o (PARI) Vec( (1-x)/(1+x-2*x^2+x^3)+O(x^99)) \\ _Charles R Greathouse IV_, Sep 23 2012

%o (PARI) my(p= Mod('x,'x^3+'x^2-2*'x+1)); a(n) = vecsum(Vec(lift(p^(n+4)))); \\ _Kevin Ryde_, Jan 28 2023

%o (Magma) [n le 3 select (-2)^(n-1) else -Self(n-1) +2*Self(n-2) -Self(n-3): n in [1..41]]; // _G. C. Greubel_, Jan 24 2023

%o (SageMath)

%o @CachedFunction

%o def a(n): # a = A078039

%o if(n<3): return (1,-2,4)[n]

%o else: return -a(n-1) + 2*a(n-2) - a(n-3)

%o [a(n) for n in range(41)] # _G. C. Greubel_, Jan 24 2023

%Y Cf. A002478.

%K sign,easy

%O 0,2

%A _N. J. A. Sloane_, Nov 17 2002

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 7 21:53 EDT 2024. Contains 372317 sequences. (Running on oeis4.)