login
Expansion of 1/(1-3x+3x^3) in powers of x.
2

%I #10 Jan 08 2021 17:41:32

%S 1,3,9,24,63,162,414,1053,2673,6777,17172,43497,110160,278964,706401,

%T 1788723,4529277,11468628,29039715,73531314,186188058,471445029,

%U 1193741145,3022659261,7653642696,19379704653,49071136176,124252480440

%N Expansion of 1/(1-3x+3x^3) in powers of x.

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

%F a(n)=3a(n-1)-3a(n-3); a(n)=sum{k=0..floor(n/2), comb(n-2k, k) (-1)^k 3^(n-2k) }.

%e G.f. = 1 + 3*x + 9*x^2 + 24*x^3 + 63*x^4 + 162*x^5 + 414*x^6 + 1053*x^7 + ...

%t LinearRecurrence[{3,0,-3},{1,3,9},30] (* _Harvey P. Dale_, Jan 08 2021 *)

%o (PARI) {a(n) = sum(k=0, n\3, binomial(n - 2*k, k) * (-1)^k * 3^(n - 2*k))}; /* _Michael Somos_, Jan 30 2015 */

%o (PARI) {a(n) = if( n<0, 0, polcoeff( 1 / (1 - 3*x + 3*x^3) + x * O(x^n), n))}; /* _Michael Somos_, Jan 30 2015 */

%K easy,nonn

%O 0,2

%A _Paul Barry_, Nov 28 2003