OFFSET
1,1
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..5000
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
a(n) = a(n-1) + a(n-3) - a(n-4) for n>4.
a(n) = floor((7*n-1)/3). [Gary Detlefs, May 14 2011]
G.f.: x*(2+2*x+2*x^2+x^3)/((1-x)^2*(1+x+x^2)). [Colin Barker, Mar 13 2012]
a(n) = 2*n + ceiling(n/3) - 1. - Arkadiusz Wesolowski, Sep 19 2012
From Wesley Ivan Hurt, Jun 10 2016: (Start)
a(n) = (21*n-6-3*cos(2*n*Pi/3)+sqrt(3)*sin(2*n*Pi/3))/9.
a(3k) = 7k-1, a(3k-1) = 7k-3, a(3k-2) = 7k-5. (End)
MAPLE
A047292:=n->(21*n-6-3*cos(2*n*Pi/3)+sqrt(3)*sin(2*n*Pi/3))/9: seq(A047292(n), n=1..100); # Wesley Ivan Hurt, Jun 10 2016
MATHEMATICA
Select[Range[0, 125], MemberQ[{2, 4, 6}, Mod[#, 7]]&] (* Vincenzo Librandi, Apr 26 2012 *)
LinearRecurrence[{1, 0, 1, -1}, {2, 4, 6, 9}, 70] (* Harvey P. Dale, Feb 06 2019 *)
PROG
(Magma) I:=[2, 4, 6, 9]; [n le 4 select I[n] else Self(n-1)+Self(n-3)-Self(n-4): n in [1..70]]; // Vincenzo Librandi, Apr 26 2012
(PARI) a(n) = 2*n + ceil(n/3) - 1; /* Joerg Arndt, Sep 20 2012 */
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved