OFFSET
1,3
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
a(n) = a(n-3)+3 = n-2/3-A131713(n)/3. G.f.: x*(1+x^2+x^3)/((1-x)^2*(1+x+x^2)). [R. J. Mathar, Nov 07 2008]
a(1)=1, a(2)=1, a(3)=2, a(4)=4, a(n)=a(n-1)+a(n-3)-a(n-4) for n>4. - Harvey P. Dale, Dec 09 2012
a(n) = (3*n - 2 - cos(2*n*Pi/3) + sqrt(3)*sin(2*n*Pi/3))/3. - Wesley Ivan Hurt, Jul 24 2016
a(n) = 1 + floor((n-1)/3) + floor(2*(n-1)/3). - Wesley Ivan Hurt, Jul 25 2016
a(n) = n - sign((n-1) mod 3). - Wesley Ivan Hurt, Sep 25 2017
MAPLE
a:=n->add(chrem( [n, j], [1, 3] ), j=1..n): seq(a(n)+1, n=-1..70); # Zerinvary Lajos, Apr 08 2009
MATHEMATICA
LinearRecurrence[{1, 0, 1, -1}, {1, 1, 2, 4}, 80] (* Harvey P. Dale, Dec 09 2012 *)
PROG
(Magma) I:=[1, 1, 2]; [n le 3 select I[n] else Self(n-3)+3: n in [1..70]]; // Vincenzo Librandi, Jul 25 2016
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Giovanni Teofilatto, Nov 06 2008
STATUS
approved