A281166 a(n) = 3*a(n-1) - 3*a(n-2) + 2*a(n-3) for n>2, a(0)=a(1)=1, a(2)=3.
1, 1, 3, 8, 17, 33, 64, 127, 255, 512, 1025, 2049, 4096, 8191, 16383, 32768, 65537, 131073, 262144, 524287, 1048575, 2097152, 4194305, 8388609, 16777216, 33554431, 67108863, 134217728, 268435457, 536870913, 1073741824, 2147483647, 4294967295, 8589934592
Offset: 0
Links
- Colin Barker, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (3,-3,2).
Crossrefs
Programs
-
Magma
I:=[1,1,3]; [n le 3 select I[n] else 3*Self(n-1) - 3*Self(n-2) + 2*Self(n-3): n in [1..30]]; // G. C. Greubel, Jan 15 2018
-
Mathematica
LinearRecurrence[{3, -3, 2}, {1, 1, 3}, 30] (* Jean-François Alcover, Jan 16 2017 *)
-
PARI
Vec((1 - 2*x + 3*x^2) / ((1 - 2*x)*(1 - x + x^2)) + O(x^40)) \\ Colin Barker, Jan 16 2017
Formula
Binomial transform of the sequence of length 3: repeat [1, 0, 2].
a(n+3) = -a(n) + 9*2^n.
a(n) = 2^n - periodic 6: repeat [0, 1, 1, 0, -1, -1, 0].
a(n+6) = a(n) + 63*2^n.
a(n+1) = 2*a(n) - period 6: repeat [1, -1, -2, -1, 1, 2].
a(n) = 2^n - 2*sin(Pi*n/3)/sqrt(3). - Jean-François Alcover and Colin Barker, Jan 16 2017
G.f.: (1 - 2*x + 3*x^2)/((1 - 2*x)*(1 - x + x^2)). - Colin Barker, Jan 16 2017
Comments