OFFSET
1,1
COMMENTS
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
G.f.: x*(2+x+2*x^2+2*x^3)/((1+x+x^2)*(x-1)^2). - R. J. Mathar, Dec 04 2011
a(n) = a(n-1) + a(n-3) - a(n-4) for n>4, with a(1)=2, a(2)=3, a(3)=5, a(4)=9. - Harvey P. Dale, Apr 29 2013
a(n) = 7*floor((n-1)/3)+2^((n-1) mod 3)+1. - Gary Detlefs, May 25 2014
a(n) = (1/9)*(21*n+4*sqrt(3)*sin((2*Pi*n)/3)-6*cos((2*Pi*n)/3)-12). - Alexander R. Povolotsky, May 25 2014
a(3k) = 7k-2, a(3k-1) = 7k-4, a(3k-2) = 7k-5. - Wesley Ivan Hurt, Jun 10 2016
MAPLE
A047370:=n->7*floor((n-1)/3) + 2^((n-1) mod 3)+1; seq(A047370(n), n=1..50); # Wesley Ivan Hurt, May 25 2014
MATHEMATICA
Select[Range[200], MemberQ[{2, 3, 5}, Mod[#, 7]]&] (* or *) LinearRecurrence[ {1, 0, 1, -1}, {2, 3, 5, 9}, 60] (* Harvey P. Dale, Apr 29 2013 *)
Table[7*Floor[(n - 1)/3] + 2^Mod[n - 1, 3] + 1, {n, 50}] (* Wesley Ivan Hurt, May 25 2014 *)
PROG
(Magma) [7*Floor((n-1)/3)+2^((n-1) mod 3)+1: n in [1..50]]; // Wesley Ivan Hurt, May 25 2014
(PARI) x='x + O('x^50); Vec(x*(2+x+2*x^2+2*x^3)/((1+x+x^2)*(x-1)^2)) \\ G. C. Greubel, Feb 21 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Dec 11 1999
EXTENSIONS
More terms from Wesley Ivan Hurt, May 25 2014
STATUS
approved