OFFSET
0,1
COMMENTS
LINKS
FORMULA
G.f.: (2 - x - x^2 + 3*x^3)/((x-1)^2*(1 + x + x^2)). [corrected by Georg Fischer, Apr 17 2020]
Linear recurrence: a(n) = a(n-1) + a(n-3) - a(n-4) for n > 4.
Simple recursion: a(n) = a(n-3) + 3 for n > 2 with a(0) = 2, a(1) = 1, a(2) = 0.
Negative domain: a(-n) = -(a(n-1) + 1).
Explicit formulas:
a(n) = n + 2 - 2*(n mod 3).
a(n) = 2 - n + 6*floor(n/3).
a(n) = n + 2*(w^(2*n)*(2 + w) + w^n*(1 - w))/3 where w = (-1 + sqrt(-3))/2.
PROG
(MATLAB) a = zeros(1, 10000);
w = (-1+sqrt(-3))/2;
fprintf('0 2\n');
for n = 1:10000
a(n) = int64((3*n + 2*w^(2*n)*(w + 2) + 2*w^n*(1 - w))/3);
fprintf('%i %i\n', n, a(n));
end
CROSSREFS
KEYWORD
nonn
AUTHOR
Guenther Schrack, Mar 03 2020
STATUS
approved