login
A267806
a(0) = a(1) = 1; for n>1, a(n) = (a(n-1) mod 2) + a(n-2).
3
1, 1, 2, 1, 3, 2, 3, 3, 4, 3, 5, 4, 5, 5, 6, 5, 7, 6, 7, 7, 8, 7, 9, 8, 9, 9, 10, 9, 11, 10, 11, 11, 12, 11, 13, 12, 13, 13, 14, 13, 15, 14, 15, 15, 16, 15, 17, 16, 17, 17, 18, 17, 19, 18, 19, 19, 20, 19, 21, 20, 21, 21, 22, 21, 23, 22, 23, 23, 24, 23, 25, 24, 25, 25
OFFSET
0,3
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
EXTENSIONS
Edited by Bruno Berselli, Jan 21 2016.
STATUS
approved