OFFSET
0,3
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2,1,-2)
FORMULA
a(n) = (4*2^n - 3 + 5*(-1)^n)/6.
a(n) = Sum_{k=0..n} (2^k - 1 + 0^k)(-1)^(n-k).
a(n) = a(n-1) + 2*a(n-2) + 1, n > 1. - Gary Detlefs, Jun 20 2010
a(n) = A000975(n) + (-1)^n. - Alois P. Heinz, Jun 15 2023
MAPLE
a:= n-> ceil(2*(2^n-1)/3)+(-1)^n:
seq(a(n), n=0..32); # Alois P. Heinz, Jun 15 2023
MATHEMATICA
CoefficientList[Series[(1-2x+2x^2)/((1-x^2)(1-2x)), {x, 0, 50}], x] (* Harvey P. Dale, Mar 09 2011 *)
Table[2*2^n/3 - 1/2 + 5 (-1)^n/6, {n, 0, 32}] (* Michael De Vlieger, Feb 22 2017 *)
PROG
(PARI) for(n=0, 50, print1((4*2^n - 3 + 5*(-1)^n)/6, ", ")) \\ G. C. Greubel, Oct 10 2017
(Magma) [(4*2^n - 3 + 5*(-1)^n)/6: n in [0..50]]; // G. C. Greubel, Oct 10 2017
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Jul 22 2004
STATUS
approved