A153265 a(n) = (-2*I)^n + (2*I)^n + (1/2 + 1/2*I*sqrt(3))^n + (1/2 - 1/2*I*sqrt(3))^n.
4, 1, -9, -2, 31, 1, -126, 1, 511, -2, -2049, 1, 8194, 1, -32769, -2, 131071, 1, -524286, 1, 2097151, -2, -8388609, 1, 33554434, 1, -134217729, -2, 536870911, 1, -2147483646, 1, 8589934591, -2, -34359738369, 1
Offset: 0
Examples
a(4) = 32 + (1/2 + 1/2*I*sqrt(3))^4 + (1/2 - 1/2*I*sqrt(3))^4 = 31 -or- a(4) = a(n-1) - 5a(n-2) + 4a(n-3) - 4a(n-4) = -2 - 5*(-9) + 4*(1) - 4*4 = 31
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (1,-5,4,-4).
Programs
-
Magma
I:=[4,1,-9,-2]; [n le 4 select I[n] else Self(n-1)-5*Self(n-2)+4*Self(n-3) -4*Self(n-4): n in [1..50]]; // Vincenzo Librandi, Jun 26 2014
-
Maple
a := n-> (2*I)^n+(-2*I)^n+(1/2+1/2*I*sqrt(3))^n+(1/2-1/2*I*sqrt(3))^n;
-
Mathematica
CoefficientList[Series[4 + x (1 - 10 x + 12 x^2 - 16 x^3)/((x^2 - x + 1) (4 x^2 + 1)), {x, 0, 100}], x] (* Vincenzo Librandi, Jun 26 2014 *)
-
PARI
a(n)=2*(n%2<1)*(-4)^(n\2)+3*(n%3<1)*(-1)^(n\3)-(-1)^n \\ Tani Akinari, Jun 25 2014
Formula
a(n) = a(n-1) - 5a(n-2) + 4a(n-3) - 4a(n-4).
G.f.: 4 + x*(1-10*x+12*x^2-16*x^3)/((x^2-x+1)*(4*x^2+1)). - corrected by Vaclav Kotesovec, Jun 25 2014
Comments