OFFSET
1,2
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
a(n+1) = 3*n - 2*floor(n/3). - Gary Detlefs, Mar 27 2010
G.f.: x^2*(3+3*x+x^2) / ((1+x+x^2)*(x-1)^2). - R. J. Mathar, Oct 25 2011
From Wesley Ivan Hurt, Jun 07 2016: (Start)
a(n) = a(n-1) + a(n-3) - a(n-4) for n>4.
a(n) = (21*n-15+6*cos(2*n*Pi/3)-2*sqrt(3)*sin(2*n*Pi/3))/9.
a(3k) = 7k-1, a(3k-1) = 7k-4, a(3k-2) = 7k-7. (End)
a(n) = Sum_{i=1..n-1} numerator(3/i). - Wesley Ivan Hurt, Feb 26 2017
MAPLE
seq(3*n - 2*floor(n/3), n=0..52); # Gary Detlefs, Mar 27 2010
MATHEMATICA
Select[Range[0, 150], MemberQ[{0, 3, 6}, Mod[#, 7]]&] (* Harvey P. Dale, Oct 05 2012 *)
LinearRecurrence[{1, 0, 1, -1}, {0, 3, 6, 7}, 70] (* Vincenzo Librandi, Feb 28 2017 *)
PROG
(Magma) [n : n in [0..150] | n mod 7 in [0, 3, 6]]; // Wesley Ivan Hurt, Jun 07 2016
(PARI) a(n)=3*n - 3 - (n-1)\3*2 \\ Charles R Greathouse IV, Feb 28 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved