OFFSET
0,3
LINKS
Index entries for linear recurrences with constant coefficients, signature (0,1,1,0,-1).
FORMULA
From Bruno Berselli, Jan 21 2016: (Start)
G.f.: (1 + x + x^2 - x^3)/((1 + x)*(1 - x)^2*(1 + x + x^2)).
a(n) = a(n-2) + a(n-3) - a(n-5) for n>4.
a(n) = floor((n + 2)/3) + (1 + (-1)^n)/2. (End)
a(n) = A051274(n+2). - R. J. Mathar, May 02 2023
MATHEMATICA
RecurrenceTable[{a[0] == a[1] == 1, a[n] == Mod[a[n - 1], 2] + a[n - 2]}, a, {n, 80}]
Table[Floor[(n + 2)/3] + (1 + (-1)^n)/2, {n, 0, 80}] (* or *) LinearRecurrence[{0, 1, 1, 0, -1}, {1, 1, 2, 1, 3}, 80] (* Bruno Berselli, Jan 21 2016 *)
PROG
(PARI) a=vector(100); for(n=1, #a, if(n<3, a[n]=1, a[n]=a[n-1]%2+a[n-2])); a \\ Colin Barker, Jan 22 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
José María Grau Ribas, Jan 20 2016
EXTENSIONS
Edited by Bruno Berselli, Jan 21 2016.
STATUS
approved