cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A050683 Number of nonzero palindromes of length n.

This page as a plain text file.
%I A050683 #60 Jul 31 2025 22:03:43
%S A050683 9,9,90,90,900,900,9000,9000,90000,90000,900000,900000,9000000,
%T A050683 9000000,90000000,90000000,900000000,900000000,9000000000,9000000000,
%U A050683 90000000000,90000000000,900000000000,900000000000,9000000000000
%N A050683 Number of nonzero palindromes of length n.
%C A050683 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
%C A050683 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
%H A050683 Vincenzo Librandi, <a href="/A050683/b050683.txt">Table of n, a(n) for n = 1..1000</a>
%H A050683 Dr. Math, <a href="http://mathforum.org/dr.math/problems/stang4.8.14.97.html">More info 1.</a>
%H A050683 Dr. Math, <a href="http://mathforum.org/dr.math/problems/akyildiz1.4.98.html">More info 2.</a>
%H A050683 <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (0,10).
%F A050683 a(n) = 9*10^floor((n-1)/2).
%F A050683 From _Colin Barker_, Apr 06 2012: (Start)
%F A050683 a(n) = 10*a(n-2).
%F A050683 G.f.: 9*x*(1+x)/(1-10*x^2). (End)
%F A050683 E.g.f.: 9*(cosh(sqrt(10)*x) + sqrt(10)*sinh(sqrt(10)*x) - 1)/10. - _Stefano Spezia_, Jun 11 2022
%p A050683 seq(9*10^floor((n-1)/2),n=1..30); # _Muniru A Asiru_, Oct 07 2018
%t A050683 With[{c=9*10^Range[0,20]},Riffle[c,c]] (* or *) LinearRecurrence[{0,10},{9,9},40] (* _Harvey P. Dale_, Dec 15 2013 *)
%o A050683 (PARI) A050683(n)=9*10^((n-1)\2) \\ _M. F. Hasler_, Nov 16 2008
%o A050683 (PARI) \\ using _M. F. Hasler_'s is_A002113(n) from A002113
%o A050683 is_A002113(n)={Vecrev(n=digits(n))==n}
%o A050683 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
%o A050683 (PARI) is_palindrome(x)={my(d=digits(x));for(k=1,#d\2,if(d[k]!=d[#d+1-k],return(0)));return(1)}
%o A050683 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
%o A050683 (PARI) a(n) = if(n<3, 9, 10*a(n-2)); \\ _Altug Alkan_, Oct 03 2018
%o A050683 (Magma) [9*10^Floor((n-1)/2): n in [1..30]]; // _Vincenzo Librandi_, Aug 16 2011
%o A050683 (GAP) a:=[9,9];; for n in [3..30] do a[n]:=10*a[n-2]; od; a; # _Muniru A Asiru_, Oct 07 2018
%o A050683 (Python)
%o A050683 def A050683(n): return 9*10**(n-1>>1) # _Chai Wah Wu_, Jul 30 2025
%Y A050683 Cf. A002113, A050250, A050251, A070252, A070199.
%Y A050683 Cf. A016116 for numbers of binary palindromes, A016115 for prime palindromes.
%Y A050683 Cf. A117855 for the base 3 version, and A225367 for a variant.
%K A050683 nonn,easy,base,nice
%O A050683 1,1
%A A050683 _Patrick De Geest_, Aug 15 1999