%I #21 Sep 08 2022 08:45:37
%S 0,1,1,2,3,4,5,4,-1,-16,-51,-124,-265,-520,-955,-1652,-2689,-4080,
%T -5635,-6668,-5433,1896,22965,72028,174095,370496,725101,1328452,
%U 2292823,3722904,5631525,7743404,9086879,7208304,-3246371,-32945004,-101726745
%N The real part of complex sequence: a(n) = a(n-1) + (1+i)*a(n-2).
%C The (absolute) ratio approaches 1.744900645213449...
%H Robert Israel, <a href="/A143055/b143055.txt">Table of n, a(n) for n = 1..4120</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,1,-2,-2).
%F a(n) = Re(b(n)) where b(1) = 0, b(2) = 1, b(n) = b(n-1)+(1+i)*b(n-2).
%F From _R. J. Mathar_, Oct 24 2008: (Start)
%F G.f.: x^2*(1 - x - x^2)/(1-2*x-x^2+2*x^3+2*x^4).
%F a(n) = 2*a(n-1) + a(n-2) - 2*a(n-3) - 2*a(n-4). (End)
%e The imaginary part is: {0, 0, 0, 1, 2, 5, 10, 19, 34, 57, 90, 131, 170, 177, 82, -261, -1134, -3047, -6870, -13997, -26502, -47167, -79102, -124373, -180510, -232855, -239270, -101629, 384202, 1611025, 4288050,..}.
%p f:= gfun:-rectoproc({-a(n+4)+2*a(n+3)+a(n+2)-2*a(n+1)-2*a(n), a(1) = 0, a(2) = 1, a(3) = 1, a(4) = 2}, a(n), remember):
%p map(f, [$1..30]); # _Robert Israel_, Jul 17 2016
%t Clear[a, n]; a[0] = 0; a[1] = 1; a[n_] := a[n] = a[n - 1] + (1 + I)*a[n - 2]; Table[Re[a[n]], {n, 0, 30}]
%t CoefficientList[Series[x (1 - x - x^2) / (1 - 2 x - x^2 + 2 x^3 + 2 x^4), {x, 0, 33}], x] (* _Vincenzo Librandi_, Jul 18 2016 *)
%t LinearRecurrence[{2,1,-2,-2},{0,1,1,2},40] (* _Harvey P. Dale_, Oct 26 2019 *)
%o (Magma) I:=[0,1,1,2]; [n le 4 select I[n] else 2*Self(n-1) +Self(n-2)-2*Self(n-3)-2*Self(n-4): n in [1..40]]; // _Vincenzo Librandi_, Jul 18 2016
%K sign
%O 1,4
%A _Roger L. Bagula_ and _Gary W. Adamson_, Oct 13 2008
%E Edited by _Robert Israel_, Jul 17 2016