A050685 Number of nonzero palindromes < 10^n and containing at least one digit '0'.
0, 0, 9, 18, 189, 360, 2799, 5238, 36189, 67140, 435699, 804258, 5021289, 9238320, 56191599, 103144878, 615724389, 1128303900, 6641519499, 12154735098, 70773675489, 129392615880, 746963079399, 1364533542918, 7822667714589
Offset: 1
Examples
Up to 10^4 we find 18 numbers -> 101, 202, ..., 909, 1001, 2002, ... and 9009.
Links
- G. C. Greubel, Table of n, a(n) for n = 1..1000
- Index entries for linear recurrences with constant coefficients, signature (1,19,-19,-90,90).
Programs
-
Magma
[IsOdd(n) select (5+22*(10)^((n+1) div 2)-25*9^((n+1) div 2)) div 20 else (1+8*(10)^(n div 2)-9^((n div 2)+1)) div 4:n in [1..30]]; // Vincenzo Librandi, Oct 29 2016
-
Mathematica
LinearRecurrence[{1,19,-19,-90,90},{0,0,9,18,189},25] (* or *) Table[If[OddQ[n], (5 + 22*(10)^((n + 1)/2) - 25*9^((n + 1)/2))/20, (1 + 8*(10)^(n/2) - 9^((n/2) + 1))/4], {n, 1, 10}] (* G. C. Greubel, Oct 27 2016 *)
Formula
G.f.: (9*x^2*(x+1))/((1-x)*(1 - 9*x^2)*(1 - 10*x^2)). - Maksym Voznyy (voznyy(AT)mail.ru), Jul 28 2009
From G. C. Greubel, Oct 27 2016: (Start)
a(n) = a(n-1) + 19*a(n-2) - 19*a(n-3) - 90*a(n-4) + 90*a(n-5).
a(n) = (1/(4*sqrt(10)))*( 4*sqrt(10)*(1 + (-1)^n)*(10)^(n/2) + 22*(1 - (-1)^n)*(10)^(n/2) + sqrt(10)*(1 + ((-1)^n - 4)*3^(n + 1)) ).
E.g.f.: (1/(4*sqrt(10)))*( sqrt(10)*(3*exp(-3*x) + exp(x) -12*exp(3*x)) + 44*sinh(sqrt(10)*x) + 8*sqrt(10)*cosh(sqrt(10)*x)).
a(2*n) = (1/4)*(1 + 8*(10)^n - 9^(1 + n)), n>=1.
a(2*n+1) = (1/20)*(5 + 22*(10)^(n+1) - 25*9^(n+1)), n>=0. (End)
Extensions
More terms from Michael Lugo (mlugo(AT)thelabelguy.com), Dec 22 1999
Corrected by T. D. Noe, Nov 08 2006