OFFSET
0,2
COMMENTS
For n>0, 4*a(n) has the form 10...020...01 when it is converted to base 3. The number of zeros between 2 consecutive nonzero digits is n-1. - Raul Prisacariu, Aug 27 2024
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (13,-39,27).
FORMULA
a(n) = A007051(n)^2. - Michel Marcus, Jun 08 2013
From Colin Barker, Feb 10 2016: (Start)
a(n) = 13*a(n-1) - 39*a(n-2) + 27*a(n-3) for n > 2.
G.f.: (1-9*x+12*x^2) / ((1-x)*(1-3*x)*(1-9*x)). (End)
E.g.f.: (1/4)*(exp(x) + 2*exp(3*x) + exp(9*x)). - G. C. Greubel, May 22 2023
MATHEMATICA
(3^Range[0, 20]+1)^2/4 (* or *) LinearRecurrence[{13, -39, 27}, {1, 4, 25}, 30] (* Harvey P. Dale, Nov 05 2016 *)
PROG
(PARI) Vec((1-9*x+12*x^2)/((1-x)*(1-3*x)*(1-9*x)) + O(x^30)) \\ Colin Barker, Feb 10 2016
(Python)
def A051500(n): return (3**n+1)**2>>2 # Chai Wah Wu, Nov 14 2022
(Magma) [(3^n+1)^2/4: n in [0..40]]; // G. C. Greubel, May 22 2023
(SageMath) [((3^n+1)//2)^2 for n in range(41)] # G. C. Greubel, May 22 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved