OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (-1,1,1).
FORMULA
From Robert Israel, Dec 26 2017: (Start)
a(n) = a(n-3)+a(n-2)-a(n-1) for n >= 7.
G.f.: (2+3*x-4*x^2-x^3+2*x^4)*x^2/((1-x)*(x+1)^2). (End)
a(n) = 1/2+(-1)^n*(1/2-n), n>=4. - R. J. Mathar, May 14 2024
MAPLE
0, 2, 1, -3, seq(seq(s*i, s=[1, -1]), i=5..100, 2); # Robert Israel, Dec 26 2017
MATHEMATICA
Nest[Append[#, Block[{k = 1, s = 1}, While[Nand[FreeQ[#, s k], IntegerQ@ Mean[Append[#, s k]]], If[s == 1, s = -1, k++; s = 1]]; s k]] &, {0}, 51] (* Michael De Vlieger, Dec 12 2017 *)
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Enrique Navarrete, Dec 04 2017
STATUS
approved