|
|
A050683
|
|
Number of nonzero palindromes of length n.
|
|
17
|
|
|
9, 9, 90, 90, 900, 900, 9000, 9000, 90000, 90000, 900000, 900000, 9000000, 9000000, 90000000, 90000000, 900000000, 900000000, 9000000000, 9000000000, 90000000000, 90000000000, 900000000000, 900000000000, 9000000000000
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
In general the number of base k palindromes with n digits is (k-1)*k^floor((n-1)/2). (See A117855 or A225367 for an explanation.) - Henry Bottomley, Aug 14 2000
This sequence does not count 0 as palindrome with 1 digit, see A070252 = (10,9,90,90,...) for the variant which does. - M. F. Hasler, Nov 16 2008
|
|
LINKS
|
|
|
FORMULA
|
a(n) = 9*10^floor((n-1)/2).
a(n) = 10*a(n-2).
G.f.: 9*x*(1+x)/(1-10*x^2). (End)
E.g.f.: 9*(cosh(sqrt(10)*x) + sqrt(10)*sinh(sqrt(10)*x) - 1)/10. - Stefano Spezia, Jun 11 2022
|
|
MAPLE
|
|
|
MATHEMATICA
|
With[{c=9*10^Range[0, 20]}, Riffle[c, c]] (* or *) LinearRecurrence[{0, 10}, {9, 9}, 40] (* Harvey P. Dale, Dec 15 2013 *)
|
|
PROG
|
is_A002113(n)={Vecrev(n=digits(n))==n}
for(n=1, 8, j=0; for(k=10^(n-1), 10^n-1, if(is_A002113(k), j++)); print1(j, ", ")) \\ Hugo Pfoertner, Oct 03 2018
(PARI) is_palindrome(x)={my(d=digits(x)); for(k=1, #d\2, if(d[k]!=d[#d+1-k], return(0))); return(1)}
for(n=1, 8, j=0; for(k=10^(n-1), 10^n-1, if(is_palindrome(k), j++)); print1(j, ", ")) \\ Hugo Pfoertner, Oct 02 2018
(PARI) a(n) = if(n<3, 9, 10*a(n-2)); \\ Altug Alkan, Oct 03 2018
(GAP) a:=[9, 9];; for n in [3..30] do a[n]:=10*a[n-2]; od; a; # Muniru A Asiru, Oct 07 2018
|
|
CROSSREFS
|
Cf. A016116 for numbers of binary palindromes, A016115 for prime palindromes.
|
|
KEYWORD
|
nonn,easy,base,nice
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|