OFFSET
0,5
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2,-2,1,2).
FORMULA
From R. J. Mathar, Jul 14 2011: (Start)
G.f.: x^3/((1-x+2*x^2)*(1-x-x^2)).
MAPLE
a:= n-> (<<0|1|0|0>, <0|0|1|0>, <0|0|0|1>, <2|1|-2|2>>^n)[1, 4]:
seq(a(n), n=0..45); # Alois P. Heinz, Jul 11 2023
MATHEMATICA
LinearRecurrence[{2, -2, 1, 2}, {0, 0, 0, 1}, 100] (* Vincenzo Librandi, Nov 25 2011 *)
PROG
(Magma) I:=[0, 0, 0, 1]; [n le 4 select I[n] else 2*Self(n-1)-2*Self(n-2)+Self(n-3)+2*Self(n-4): n in [1..50]]; // Vincenzo Librandi, Nov 25 2011
(SageMath)
@CachedFunction
def a(n): # a = A192395
if (n<4): return n//3
else: return 2*a(n-1) - 2*a(n-2) + a(n-3) + 2*a(n-4)
[a(n) for n in range(51)] # G. C. Greubel, Jul 10 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paul Curtz, Jun 29 2011
STATUS
approved