login
A117862
Number of palindromes (in base 3) below 3^n.
2
0, 2, 4, 10, 16, 34, 52, 106, 160, 322, 484, 970, 1456, 2914, 4372, 8746, 13120, 26242, 39364, 78730, 118096, 236194, 354292, 708586, 1062880, 2125762, 3188644, 6377290, 9565936, 19131874, 28697812, 57395626, 86093440, 172186882, 258280324, 516560650, 774840976
OFFSET
0,2
FORMULA
a(n) = 4*3^((n-1)/2)-2 (n odd), 2*3^(n/2)-2 (n even).
G.f.: 2*x*(x+1) / ((x-1)*(3*x^2-1)). - Colin Barker, Feb 15 2013
MATHEMATICA
Table[If[OddQ[n], 4*3^((n - 1)/2) - 2, 2*3^(n/2) - 2], {n, 25}] (* or *) LinearRecurrence[{1, 3, -3}, {2, 4, 10}, 25] (* G. C. Greubel, Oct 27 2016 *)
PROG
(PARI) apply( {A117862(n)=3^(n\2)<<(1+n%2)-2}, [0..44]) \\ M. F. Hasler, Jul 28 2021
CROSSREFS
Cf. A050250.
Sequence in context: A077627 A228136 A153927 * A105024 A050871 A348305
KEYWORD
nonn,base,easy
AUTHOR
Martin Renner, May 02 2006
EXTENSIONS
More terms from Colin Barker, Feb 15 2013
Extended to offset 0 by M. F. Hasler, Jul 28 2021
STATUS
approved