OFFSET
1,3
COMMENTS
w = exp(2*Pi*i/3)= (-1 - sqrt(-3))/2. Beginning with a(2) the first differences are 3,3,3,5,5,5,7,7,7,9,9,9,11, etc.
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,-1,1,-2,1).
FORMULA
a(n) = A032765(n)-1.
a(n) = floor((n-1)*(n+1)*(n+3)/(3*n+3)). - Gary Detlefs, Jul 13 2010
a(n) = (n-1)^2 - A030511(n-1). - Wesley Ivan Hurt, Jun 19 2013
G.f.: x^2*(1+x)*(x^2-x-1) / ( (1+x+x^2)*(x-1)^3 ). - R. J. Mathar, Jun 23 2013
a(n) = n + floor(n*(n-1)/3) - 1. - Bruno Berselli, Mar 02 2017
MATHEMATICA
a[1] = 0; a[2] = 1; w = Exp[2Pi*I/3]; a[n_] := a[n] = Simplify[(2/3)(1 + w^n + w^(2n)) + 2a[n - 1] - a[n - 2]]; Table[ a[n], {n, 1, 60}]
Table[If[n<3, n-1, Floor[((n+1)^2-4)/3]], {n, 1, 100}] (* Vladimir Joseph Stephan Orlovsky, Jan 30 2012 *)
LinearRecurrence[{2, -1, 1, -2, 1}, {0, 1, 4, 7, 10}, 60] (* Harvey P. Dale, Jun 10 2016 *)
PROG
(PARI) a(n)=n*(n+2)\3 - 1 \\ Charles R Greathouse IV, Mar 02 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Robert G. Wilson v, Jun 24 2002
STATUS
approved