login
a(n) = 3^(floor(n/2))+3^(floor(n/2)-1)-3^(floor((n-1)/3)).
3

%I #19 Jul 04 2018 01:56:36

%S 3,3,9,9,33,27,99,99,297,297,945,891,2835,2835,8505,8505,26001,25515,

%T 78003,78003,234009,234009,706401,702027,2119203,2119203,6357609,

%U 6357609,19112193,19072827,57336579,57336579,172009737,172009737,516383505,516029211,1549150515

%N a(n) = 3^(floor(n/2))+3^(floor(n/2)-1)-3^(floor((n-1)/3)).

%H R. P. Stanley, <a href="https://www.jstor.org/stable/10.4169/000298910x475032">Problem 11348</a>, Amer. Math. Monthly, 117 (2010), 87-88.

%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (0,3,3,0,-9).

%F a(n) = 3*a(n-2) +3*a(n-3) -9*a(n-5). G.f.: -3*x^2*(x^4+3*x^3-x-1) / ((3*x^2-1)*(3*x^3-1)). - _Colin Barker_, Jul 26 2013

%t LinearRecurrence[{0,3,3,0,-9},{3,3,9,9,33},40] (* _Harvey P. Dale_, Dec 18 2015 *)

%Y Cf. A170831, A170833, A170834.

%K nonn,easy

%O 2,1

%A _N. J. A. Sloane_, Dec 30 2009