A070252 Number of n-digit palindromes.
10, 9, 90, 90, 900, 900, 9000, 9000, 90000, 90000, 900000, 900000, 9000000, 9000000, 90000000, 90000000, 900000000, 900000000, 9000000000, 9000000000, 90000000000, 90000000000, 900000000000, 900000000000, 9000000000000
Offset: 1
Links
- Index entries for linear recurrences with constant coefficients, signature (0,10).
Crossrefs
Programs
-
Mathematica
LinearRecurrence[{0,10},{10,9,90},25] (* Stefano Spezia, Jun 11 2022 *)
-
Python
def A070252(n): return 10 if n==1 else 9*10**(n-1>>1) # Chai Wah Wu, Jul 30 2025
Formula
From Colin Barker, Aug 19 2013: (Start)
a(n) = 10*a(n-2) for n>3.
G.f.: x*(10*x^2-9*x-10) / (10*x^2-1). (End)
E.g.f.: x + 9*(cosh(sqrt(10)*x) - 1 + sqrt(10)*sinh(sqrt(10)*x))/10. - Stefano Spezia, Jun 11 2022