This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A078039 #29 Jan 29 2023 06:01:32 %S A078039 1,-2,4,-9,19,-41,88,-189,406,-872,1873,-4023,8641,-18560,39865, %T A078039 -85626,183916,-395033,848491,-1822473,3914488,-8407925,18059374, %U A078039 -38789712,83316385,-178955183,384377665,-825604416,1773314929,-3808901426,8181135700,-17572253481,37743426307,-81069068969 %N A078039 Expansion of (1 - x)/(1 + x - 2*x^2 + x^3). %C A078039 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 A078039 Sequence is identical to its second differences negated, minus the first 3 terms. - _Paul Curtz_, Feb 10 2008 %H A078039 G. C. Greubel, <a href="/A078039/b078039.txt">Table of n, a(n) for n = 0..1000</a> %H A078039 <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (-1,2,-1). %F A078039 a(n) = -a(n-1) + 2*a(n-2) - a(n-3). - _Paul Curtz_, Feb 10 2008 %F A078039 a(n) = (-1)^n * (A002478(n) + A002478(n+1)). - _Ralf Stephan_, Aug 19 2013 %t A078039 LinearRecurrence[{-1,2,-1}, {1,-2,4}, 41] (* _G. C. Greubel_, Jan 24 2023 *) %o A078039 (PARI) Vec( (1-x)/(1+x-2*x^2+x^3)+O(x^99)) \\ _Charles R Greathouse IV_, Sep 23 2012 %o A078039 (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 A078039 (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 A078039 (SageMath) %o A078039 @CachedFunction %o A078039 def a(n): # a = A078039 %o A078039 if(n<3): return (1,-2,4)[n] %o A078039 else: return -a(n-1) + 2*a(n-2) - a(n-3) %o A078039 [a(n) for n in range(41)] # _G. C. Greubel_, Jan 24 2023 %Y A078039 Cf. A002478. %K A078039 sign,easy %O A078039 0,2 %A A078039 _N. J. A. Sloane_, Nov 17 2002