A117866 Number of palindromes (in base 7) below 7^n.
6, 12, 54, 96, 390, 684, 2742, 4800, 19206, 33612, 134454, 235296, 941190, 1647084, 6588342, 11529600, 46118406, 80707212, 322828854, 564950496, 2259801990, 3954653484, 15818613942, 27682574400, 110730297606, 193778020812, 775112083254, 1356446145696
Offset: 1
Links
- G. C. Greubel, Table of n, a(n) for n = 1..1000
- Index entries for linear recurrences with constant coefficients, signature (1,7,-7).
Crossrefs
Cf. A050250.
Programs
-
Magma
[IsOdd(n) select 8*7^((n-1) div 2)-2 else 2*7^(n div 2)-2: n in [1..30]]; // Vincenzo Librandi, Oct 29 2016
-
Mathematica
Table[If[OddQ[n],8*7^((n-1)/2)-2,2*7^(n/2)-2],{n,30}] (* or *) LinearRecurrence[{1,7,-7},{6,12,54},30] (* Harvey P. Dale, Oct 31 2013 *) Rest@ CoefficientList[Series[6 x (x + 1)/((x - 1) (7 x^2 - 1)), {x, 0, 28}], x] (* Michael De Vlieger, Oct 31 2016 *)
-
PARI
a(n)=([0,1,0; 0,0,1; -7,7,1]^(n-1)*[6;12;54])[1,1] \\ Charles R Greathouse IV, Oct 31 2016
Formula
a(n) = 8*7^((n-1)/2)-2 (n odd), 2*7^(n/2)-2 (n even).
G.f.: 6*x*(x+1) / ((x-1)*(7*x^2-1)). - Colin Barker, Feb 15 2013
From G. C. Greubel, Oct 27 2016: (Start)
a(n) = a(n-1) + 7*a(n-2) - 7*a(n-3).
a(n) = (1/sqrt(7))*(-2*sqrt(7) + 7^((n+1)/2) + (-1)^n*7^((n+1)/2) + 4*7^(n/2) - 4*(-1)^n*7^(n/2)).
E.g.f.: (1/sqrt(7))*( (sqrt(7) - 4)*exp(-sqrt(7)*x) + (4 + sqrt(7))*exp(sqrt(7)*x) - 2*sqrt(7)*exp(x)). (End)
Extensions
More terms from Colin Barker, Feb 15 2013