OFFSET
0,2
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (4, -6, 12, -9).
FORMULA
G.f.: 1/((x-1)*(3*x-1)*(3*x^2+1)).
a(n) = Sum{k=0..n} A154957(n,k)*3^k.
a(n) = 4*a(n-1) - 6*a(n-2) + 12*a(n-3) - 9*a(n-4) for n > 3, a(0)=1, a(1)=4, a(2)=10, a(3)=16.
a(n) = ( -1 + 3^(2+n) + (-1+(-1)^n)*(-3)^((1+n)/2) )/8. [Bruno Berselli, Mar 24 2014]
EXAMPLE
Ternary................Decimal
1............................1
11...........................4
101.........................10
1001........................28
10101.......................91
101101.....................280
1010101....................820
10100101..................2440
101010101.................7381
1010110101...............22204
10101010101..............66430
101010010101............199108, etc.
MATHEMATICA
Table[(-1 + 3^(2 + n) + (-1 + (-1)^n) (-3)^((1 + n)/2))/8, {n, 0, 30}] (* Bruno Berselli, Mar 24 2014 *)
CoefficientList[Series[1/((x - 1) (3 x - 1) (3 x^2 + 1)), {x, 0, 40}], x] (* Vincenzo Librandi, Mar 24 2014 *)
LinearRecurrence[{4, -6, 12, -9}, {1, 4, 10, 28}, 30] (* Harvey P. Dale, Oct 04 2024 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Philippe Deléham, Mar 21 2014
STATUS
approved