CINXE.COM

A002113 - OEIS

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <link rel="stylesheet" href="/styles.css"> <meta name="format-detection" content="telephone=no"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name=viewport content="width=device-width, initial-scale=1"> <meta name="keywords" content="OEIS,integer sequences,Sloane" /> <title>A002113 - OEIS</title> <link rel="search" type="application/opensearchdescription+xml" title="OEIS" href="/oeis.xml"> <script> var myURL = "\/A002113" function redir() { var host = document.location.hostname; if(host != "oeis.org" && host != "127.0.0.1" && !/^([0-9.]+)$/.test(host) && host != "localhost" && host != "localhost.localdomain") { document.location = "https"+":"+"//"+"oeis"+".org/" + myURL; } } function sf() { if(document.location.pathname == "/" && document.f) document.f.q.focus(); } </script> </head> <body bgcolor=#ffffff onload="redir();sf()"> <div class=loginbar> <div class=login> <a href="/login?redirect=%2fA002113">login</a> </div> </div> <div class=center><div class=top> <center> <div class=donors> The OEIS is supported by <a href="http://oeisf.org/#DONATE">the many generous donors to the OEIS Foundation</a>. </div> <div class=banner> <a href="/"><img class=banner border="0" width="600" src="/banner2021.jpg" alt="A002113 - OEIS"></a> </div> <div class="motdbox"> <div class="motd"> <p>Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).</p> </div> <div class="donate"> <div id="donate-button-container"> <div id="donate-button"></div> <script src="https://www.paypalobjects.com/donate/sdk/donate-sdk.js" charset="UTF-8"></script> <script> PayPal.Donation.Button({ env:'production', hosted_button_id:'SVPGSDDCJ734A', image: { src:'https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif', alt:'Donate with PayPal button', title:'PayPal - The safer, easier way to pay online!', } }).render('#donate-button'); </script> </div> <a href="https://oeisf.org/donate/"> <strong>Other ways to Give</strong> </a> </div> </div> </center> </div></div> <div class=center><div class=pagebody> <div class=searchbarcenter> <form name=f action="/search" method="GET"> <div class=searchbargreet> <div class=searchbar> <div class=searchq> <input class=searchbox maxLength=1024 name=q value="" title="Search Query"> </div> <div class=searchsubmit> <input type=submit value="Search" name=go> </div> <div class=hints> <span class=hints><a href="/hints.html">Hints</a></span> </div> </div> <div class=searchgreet> (Greetings from <a href="/welcome">The On-Line Encyclopedia of Integer Sequences</a>!) </div> </div> </form> </div> <div class=sequence> <div class=space1></div> <div class=line></div> <div class=seqhead> <div class=seqnumname> <div class=seqnum> A002113 </div> <div class=seqname> Palindromes in base 10. <br><font size=-1>(Formerly M0484 N0178)</font> </div> </div> <div class=scorerefs> 807 </div> </div> <div> <div class=seqdatabox> <div class=seqdata>0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 303, 313, 323, 333, 343, 353, 363, 373, 383, 393, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 505, 515</div> <div class=seqdatalinks> (<a href="/A002113/list">list</a>; <a href="/A002113/graph">graph</a>; <a href="/search?q=A002113+-id:A002113">refs</a>; <a href="/A002113/listen">listen</a>; <a href="/history?seq=A002113">history</a>; <a href="/search?q=id:A002113&fmt=text">text</a>; <a href="/A002113/internal">internal format</a>) </div> </div> </div> <div class=entry> <div class=section> <div class=sectname>OFFSET</div> <div class=sectbody> <div class=sectline>1,3</div> </div> </div> <div class=section> <div class=sectname>COMMENTS</div> <div class=sectbody> <div class=sectline>n is a palindrome (i.e., a(k) = n for some k) if and only if n = <a href="/A004086" title="Read n backwards (referred to as R(n) in many sequences).">A004086</a>(n). - <a href="/wiki/User:Reinhard_Zumkeller">Reinhard Zumkeller</a>, Mar 10 2002</div> <div class=sectline>It seems that if n*reversal(n) is in the sequence then n = 3 or all digits of n are less than 3. - <a href="/wiki/User:Farideh_Firoozbakht">Farideh Firoozbakht</a>, Nov 02 2014</div> <div class=sectline>The position of a palindrome within the sequence can be determined almost without calculation: If the palindrome has an even number of digits, prepend a 1 to the front half of the palindrome's digits. If the number of digits is odd, prepend the value of front digit + 1 to the digits from position 2 ... central digit. Examples: 98766789 = a(19876), 515 = a(61), 8206028 = a(9206), 9230329 = a(10230). - <a href="/wiki/User:Hugo_Pfoertner">Hugo Pfoertner</a>, Aug 14 2015</div> <div class=sectline>This sequence is an additive basis of order at most 49, see Banks link. - <a href="/wiki/User:Charles_R_Greathouse_IV">Charles R Greathouse IV</a>, Aug 23 2015</div> <div class=sectline>The order has been reduced from 49 to 3; see the Cilleruelo-Luca and Cilleruelo-Luca-Baxter links. - <a href="/wiki/User:Jonathan_Sondow">Jonathan Sondow</a>, Nov 27 2017</div> <div class=sectline>See <a href="/A262038" title="Least palindrome &gt;= n.">A262038</a> for the &quot;next palindrome&quot; and <a href="/A261423" title="Largest palindrome &lt;= n.">A261423</a> for the &quot;preceding palindrome&quot; functions. - <a href="/wiki/User:M._F._Hasler">M. F. Hasler</a>, Sep 09 2015</div> <div class=sectline>The number of palindromes with d digits is 10 if d = 1, and otherwise it is 9 * 10^(floor((d - 1)/2)). - <a href="/wiki/User:N._J._A._Sloane">N. J. A. Sloane</a>, Dec 06 2015</div> <div class=sectline>Sequence <a href="/A033665" title="Number of 'Reverse and Add' steps needed to reach a palindrome starting at n, or -1 if n never reaches a palindrome.">A033665</a> tells how many iterations of the Reverse-then-add function <a href="/A056964" title="a(n) = n + reversal of digits of n.">A056964</a> are needed to reach a palindrome; numbers for which this will never happen are Lychrel numbers (<a href="/A088753" title="Numbers n such that the Reverse and Add! trajectory of n (presumably) does not reach a palindrome (with the exception of n i...">A088753</a>) or rather Kin numbers (<a href="/A023108" title="Positive integers which apparently never result in a palindrome under repeated applications of the function A056964(x) = x +...">A023108</a>). - <a href="/wiki/User:M._F._Hasler">M. F. Hasler</a>, Apr 13 2019</div> </div> </div> <div class=section> <div class=sectname>REFERENCES</div> <div class=sectbody> <div class=sectline>Karl G. Kröber, &quot;Palindrome, Perioden und Chaoten: 66 Streifzüge durch die palindromischen Gefilde&quot; (1997, Deutsch-Taschenbücher; Bd. 99) ISBN 3-8171-1522-9.</div> <div class=sectline>Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 71.</div> <div class=sectline>N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).</div> <div class=sectline>N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).</div> </div> </div> <div class=section> <div class=sectname>LINKS</div> <div class=sectbody> <div class=sectline>T. D. Noe, <a href="/A002113/b002113.txt">List of first 19999 palindromes: Table of n, a(n) for n = 1..19999</a></div> <div class=sectline>Hunki Baek, Sejeong Bang, Dongseok Kim, and Jaeun Lee, <a href="http://arxiv.org/abs/1412.2426">A bijection between aperiodic palindromes and connected circulant graphs</a>, arXiv:1412.2426 [math.CO], 2014.</div> <div class=sectline>William D. Banks, Derrick N. Hart, and Mayumi Sakata, <a href="http://dx.doi.org/10.4310/MRL.2004.v11.n6.a10">Almost all palindromes are composite</a>, Math. Res. Lett., Vol. 11, No. 5-6 (2004), pp. 853-868.</div> <div class=sectline>William D. Banks, <a href="http://arxiv.org/abs/1508.04721">Every natural number is the sum of forty-nine palindromes</a>, arXiv:1508.04721 [math.NT], 2015; <a href="https://www.emis.de/journals/INTEGERS/papers/q3/q3.Abstract.html">Integers</a>, 16 (2016), article A3.</div> <div class=sectline>Javier Cilleruelo, Florian Luca and Lewis Baxter, <a href="https://doi.org/10.1090/mcom/3221">Every positive integer is a sum of three palindromes</a>, Mathematics of Computation, Vol. 87, No. 314 (2018), pp. 3023-3055, <a href="http://arxiv.org/abs/1602.06208">arXiv preprint</a>, arXiv:1602.06208 [math.NT], 2017.</div> <div class=sectline>Patrick De Geest, <a href="http://www.worldofnumbers.com/">World of Numbers</a>.</div> <div class=sectline>Kritkhajohn Onphaeng, Tammatada Khemaratchatakumthorn, Phakhinkon Napp Phunphayap, and Prapanpong Pongsriiam, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL27/Phunphayap/phun7.html">Exact Formulas for the Number of Palindromes in Certain Arithmetic Progressions</a>, Journal of Integer Sequences, Vol. 27 (2024), Article 24.4.8. See p. 2.</div> <div class=sectline>Phakhinkon Phunphayap and Prapanpong Pongsriiam, <a href="https://arxiv.org/abs/1803.00161">Reciprocal sum of palindromes</a>, arXiv:1803.00161 [math.CA], 2018.</div> <div class=sectline>Simon Plouffe, <a href="https://arxiv.org/abs/0911.4975">Approximations de séries génératrices et quelques conjectures</a>, Dissertation, Université du Québec à Montréal, 1992; arXiv:0911.4975 [math.NT], 2009.</div> <div class=sectline>Simon Plouffe, <a href="/A000051/a000051_2.pdf">1031 Generating Functions</a>, Appendix to Thesis, Montreal, 1992</div> <div class=sectline>Prapanpong Pongsriiam and Kittipong Subwattanachai, <a href="http://ijmcs.future-in-tech.net/14.1/R-Pongsriiam.pdf">Exact Formulas for the Number of Palindromes up to a Given Positive Integer</a>, Intl. J. of Math. Comp. Sci. (2019) 14:1, 27-46.</div> <div class=sectline>E. A. Schmidt, <a href="https://web.archive.org/web/20110126180310/http://eric-schmidt.com:80/eric/palindrome/index.html">Positive Integer Palindromes</a>. [Cached copy at the Wayback Machine]</div> <div class=sectline>Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PalindromicNumber.html">Palindromic Number</a>.</div> <div class=sectline>Wikipedia, <a href="http://www.wikipedia.org/wiki/Palindromic_number">Palindromic number</a>.</div> <div class=sectline><a href="/index/Ab#basis_03">Index entries for sequences that are an additive basis</a>, order 3.</div> <div class=sectline><a href="/index/Pac#palindromes">Index entries for sequences related to palindromes</a></div> <div class=sectline><a href="/index/Cor#core">Index entries for &quot;core&quot; sequences</a></div> </div> </div> <div class=section> <div class=sectname>FORMULA</div> <div class=sectbody> <div class=sectline><a href="/A136522" title="a(n) = 1 if n is a palindrome, otherwise 0.">A136522</a>(a(n)) = 1.</div> <div class=sectline><a href="/A178788" title="Characteristic function of numbers having distinct digits in their decimal representation.">A178788</a>(a(n)) = 0 for n &gt; 9. - <a href="/wiki/User:Reinhard_Zumkeller">Reinhard Zumkeller</a>, Jun 30 2010</div> <div class=sectline><a href="/A064834" title="If n (in base 10) is d_1 d_2 ... d_k then a(n) = Sum_{i = 1..[k/2] } |d_i - d_{k-i+1}|.">A064834</a>(a(n)) = 0. - <a href="/wiki/User:Reinhard_Zumkeller">Reinhard Zumkeller</a>, Sep 18 2013</div> <div class=sectline>a(n+1) = <a href="/A262038" title="Least palindrome &gt;= n.">A262038</a>(a(n)+1). - <a href="/wiki/User:M._F._Hasler">M. F. Hasler</a>, Sep 09 2015</div> <div class=sectline>Sum_{n&gt;=2} 1/a(n) = <a href="/A118031" title="Decimal expansion of the sum of the reciprocals of the palindromic numbers A002113.">A118031</a>. - <a href="/wiki/User:Amiram_Eldar">Amiram Eldar</a>, Oct 17 2020</div> </div> </div> <div class=section> <div class=sectname>MAPLE</div> <div class=sectbody> <div class=sectline>read transforms; t0:=[]; for n from 0 to 2000 do if digrev(n) = n then t0:=[op(t0), n]; fi; od: t0;</div> <div class=sectline># Alternatively, to get all palindromes with &lt;= N digits in the list &quot;Res&quot;:</div> <div class=sectline>N:=5;</div> <div class=sectline>Res:= $0..9:</div> <div class=sectline>for d from 2 to N do</div> <div class=sectline> if d::even then</div> <div class=sectline> m:= d/2;</div> <div class=sectline> Res:= Res, seq(n*10^m + digrev(n), n=10^(m-1)..10^m-1);</div> <div class=sectline> else</div> <div class=sectline> m:= (d-1)/2;</div> <div class=sectline> Res:= Res, seq(seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1);</div> <div class=sectline> fi</div> <div class=sectline>od: Res:=[Res]: # <a href="/wiki/User:Robert_Israel">Robert Israel</a>, Aug 10 2014</div> <div class=sectline># A variant: Gets all base-10 palindromes with exactly d digits, in the list &quot;Res&quot;</div> <div class=sectline>d:=4:</div> <div class=sectline>if d=1 then Res:= [$0..9]:</div> <div class=sectline>elif d::even then</div> <div class=sectline> m:= d/2:</div> <div class=sectline> Res:= [seq(n*10^m + digrev(n), n=10^(m-1)..10^m-1)]:</div> <div class=sectline>else</div> <div class=sectline> m:= (d-1)/2:</div> <div class=sectline> Res:= [seq(seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1)]:</div> <div class=sectline>fi:</div> <div class=sectline>Res; # <a href="/wiki/User:N._J._A._Sloane">N. J. A. Sloane</a>, Oct 18 2015</div> <div class=sectline>isA002113 := proc(n)</div> <div class=sectline> simplify(digrev(n) = n) ;</div> <div class=sectline>end proc: # <a href="/wiki/User:R._J._Mathar">R. J. Mathar</a>, Sep 09 2015</div> </div> </div> <div class=section> <div class=sectname>MATHEMATICA</div> <div class=sectbody> <div class=sectline>palQ[n_Integer, base_Integer] := Module[{idn = IntegerDigits[n, base]}, idn == Reverse[idn]]; (* then to generate any base-b sequence for 1 &lt; b &lt; 37, replace the 10 in the following instruction with b: *) Select[Range[0, 1000], palQ[#, 10] &amp;]</div> <div class=sectline>base10Pals = {0}; r = 2; Do[Do[AppendTo[base10Pals, n * 10^(IntegerLength[n] - 1) + FromDigits@Rest@Reverse@IntegerDigits[n]], {n, 10^(e - 1), 10^e - 1}]; Do[AppendTo[base10Pals, n * 10^IntegerLength[n] + FromDigits@Reverse@IntegerDigits[n]], {n, 10^(e - 1), 10^e - 1}], {e, r}]; base10Pals (* <a href="/wiki/User:Arkadiusz_Wesolowski">Arkadiusz Wesolowski</a>, May 04 2012 *)</div> <div class=sectline>nthPalindromeBase[n_, b_] := Block[{q = n + 1 - b^Floor[Log[b, n + 1 - b^Floor[Log[b, n/b]]]], c = Sum[Floor[Floor[n/((b + 1) b^(k - 1) - 1)]/(Floor[n/((b + 1) b^(k - 1) - 1)] - 1/b)] - Floor[Floor[n/(2 b^k - 1)]/(Floor[n/(2 b^k - 1)] - 1/ b)], {k, Floor[Log[b, n]]}]}, Mod[q, b] (b + 1)^c * b^Floor[Log[b, q]] + Sum[Floor[Mod[q, b^(k + 1)]/b^k] b^(Floor[Log[b, q]] - k) (b^(2 k + c) + 1), {k, Floor[Log[b, q]]}]] (* after the work of Eric A. Schmidt, works for all integer bases b &gt; 2 *)</div> <div class=sectline>Array[nthPalindromeBase[#, 10] &amp;, 61, 0] (* please note that Schmidt uses a different, a more natural and intuitive offset, that of a(1) = 1. - <a href="/wiki/User:Robert_G._Wilson_v">Robert G. Wilson v</a>, Sep 22 2014 and modified Nov 28 2014 *)</div> <div class=sectline>Select[Range[10^3], PalindromeQ] (* <a href="/wiki/User:Michael_De_Vlieger">Michael De Vlieger</a>, Nov 27 2017 *)</div> <div class=sectline>nLP[cn_Integer]:=Module[{s, len, half, left, pal, fdpal}, s=IntegerDigits[cn]; len=Length[s]; half=Ceiling[len/2]; left=Take[s, half]; pal=Join[left, Reverse[ Take[left, Floor[len/2]]]]; fdpal=FromDigits[pal]; Which[cn==9, 11, fdpal&gt;cn, fdpal, True, left=IntegerDigits[ FromDigits[left]+1]; pal=Join[left, Reverse[Take[left, Floor[len/2]]]]; FromDigits[pal]]]; NestList[nLP, 0, 100] (* <a href="/wiki/User:Harvey_P._Dale">Harvey P. Dale</a>, Dec 10 2024 *)</div> </div> </div> <div class=section> <div class=sectname>PROG</div> <div class=sectbody> <div class=sectline>(PARI) is_<a href="/A002113" title="Palindromes in base 10.">A002113</a>(n)=Vecrev(n=digits(n))==n \\ <a href="/wiki/User:M._F._Hasler">M. F. Hasler</a>, Nov 17 2008, updated Apr 26 2014, Jun 19 2018</div> <div class=sectline>(PARI) is(n)=n=digits(n); for(i=1, #n\2, if(n[i]!=n[#n+1-i], return(0))); 1 \\ <a href="/wiki/User:Charles_R_Greathouse_IV">Charles R Greathouse IV</a>, Jan 04 2013</div> <div class=sectline>(PARI) a(n)={my(d, i, r); r=vector(#digits(n-10^(#digits(n\11)))+#digits(n\11)); n=n-10^(#digits(n\11)); d=digits(n); for(i=1, #d, r[i]=d[i]; r[#r+1-i]=d[i]); sum(i=1, #r, 10^(#r-i)*r[i])} \\ <a href="/wiki/User:David_A._Corneth">David A. Corneth</a>, Jun 06 2014</div> <div class=sectline>(PARI) \\ recursive--feed an element a(n) and it gives a(n+1)</div> <div class=sectline>nxt(n)=my(d=digits(n)); i=(#d+1)\2; while(i&amp;&amp;d[i]==9, d[i]=0; d[#d+1-i]=0; i--); if(i, d[i]++; d[#d+1-i]=d[i], d=vector(#d+1); d[1]=d[#d]=1); sum(i=1, #d, 10^(#d-i)*d[i]) \\ <a href="/wiki/User:David_A._Corneth">David A. Corneth</a>, Jun 06 2014</div> <div class=sectline>(PARI) \\ feed a(n), returns n.</div> <div class=sectline>inv(n)={my(d=digits(n)); q=ceil(#d/2); sum(i=1, q, 10^(q-i)*d[i])+10^floor(#d/2)} \\ <a href="/wiki/User:David_A._Corneth">David A. Corneth</a>, Jun 18 2014</div> <div class=sectline>(PARI) inv_<a href="/A002113" title="Palindromes in base 10.">A002113</a>(P)={P\(P=10^(logint(P+!P, 10)\/2))+P} \\ index n of palindrome P = a(n), much faster than above: no sum is needed. - <a href="/wiki/User:M._F._Hasler">M. F. Hasler</a>, Sep 09 2018</div> <div class=sectline>(PARI) <a href="/A002113" title="Palindromes in base 10.">A002113</a>(n, L=logint(n, 10))=(n-=L=10^max(L-(n&lt;11*10^(L-1)), 0))*L+fromdigits(Vecrev(digits(if(n&lt;L, n, n\10)))) \\ <a href="/wiki/User:M._F._Hasler">M. F. Hasler</a>, Sep 11 2018</div> <div class=sectline>(Python) # edited by <a href="/wiki/User:M._F._Hasler">M. F. Hasler</a>, Jun 19 2018</div> <div class=sectline>def <a href="/A002113" title="Palindromes in base 10.">A002113</a>_list(nMax):</div> <div class=sectline> mlist=[]</div> <div class=sectline> for n in range(nMax+1):</div> <div class=sectline> mstr=str(n)</div> <div class=sectline> if mstr==mstr[::-1]:</div> <div class=sectline> mlist.append(n)</div> <div class=sectline> return mlist # <a href="/wiki/User:Bill_McEachen">Bill McEachen</a>, Dec 17 2010</div> <div class=sectline>(Python)</div> <div class=sectline>from itertools import chain</div> <div class=sectline><a href="/A002113" title="Palindromes in base 10.">A002113</a> = sorted(chain(map(lambda x:int(str(x)+str(x)[::-1]), range(1, 10**3)), map(lambda x:int(str(x)+str(x)[-2::-1]), range(10**3)))) # <a href="/wiki/User:Chai_Wah_Wu">Chai Wah Wu</a>, Aug 09 2014</div> <div class=sectline>(Python)</div> <div class=sectline>from itertools import chain, count</div> <div class=sectline><a href="/A002113" title="Palindromes in base 10.">A002113</a> = chain(k for k in count(0) if str(k) == str(k)[::-1])</div> <div class=sectline>print([next(<a href="/A002113" title="Palindromes in base 10.">A002113</a>) for k in range(60)]) # <a href="/wiki/User:Jan_P._Hartkopf">Jan P. Hartkopf</a>, Apr 10 2021</div> <div class=sectline>(Python) is_<a href="/A002113" title="Palindromes in base 10.">A002113</a> = lambda n: (s:=str(n))[::-1]==s # <a href="/wiki/User:M._F._Hasler">M. F. Hasler</a>, May 23 2024</div> <div class=sectline>(Python)</div> <div class=sectline>from math import log10, floor</div> <div class=sectline>def <a href="/A002113" title="Palindromes in base 10.">A002113</a>(n):</div> <div class=sectline> if n &lt; 2: return 0</div> <div class=sectline> P = 10**floor(log10(n//2)); M = 11*P</div> <div class=sectline> s = str(n - (P if n &lt; M else M-P))</div> <div class=sectline> return int(s + s[-2 if n &lt; M else -1::-1]) # <a href="/wiki/User:M._F._Hasler">M. F. Hasler</a>, Jun 06 2024</div> <div class=sectline>(Haskell)</div> <div class=sectline> a002113 n = a002113_list !! (n-1)</div> <div class=sectline> a002113_list = filter ((== 1) . a136522) [1..] -- <a href="/wiki/User:Reinhard_Zumkeller">Reinhard Zumkeller</a>, Oct 09 2011</div> <div class=sectline>(Haskell)</div> <div class=sectline> import Data.List.Ordered (union)</div> <div class=sectline> a002113_list = union a056524_list a056525_list -- <a href="/wiki/User:Reinhard_Zumkeller">Reinhard Zumkeller</a>, Jul 29 2015, Dec 28 2011</div> <div class=sectline>(Magma) [n: n in [0..600] | Intseq(n, 10) eq Reverse(Intseq(n, 10))]; // <a href="/wiki/User:Vincenzo_Librandi">Vincenzo Librandi</a>, Nov 03 2014</div> <div class=sectline>(SageMath)</div> <div class=sectline>[n for n in (0..515) if Word(n.digits()).is_palindrome()] # <a href="/wiki/User:Peter_Luschny">Peter Luschny</a>, Sep 13 2018</div> <div class=sectline>(GAP) Filtered([0..550], n-&gt;ListOfDigits(n)=Reversed(ListOfDigits(n))); # <a href="/wiki/User:Muniru_A_Asiru">Muniru A Asiru</a>, Mar 08 2019</div> <div class=sectline>(Scala) def palQ(n: Int, b: Int = 10): Boolean = n - Integer.parseInt(n.toString.reverse) == 0</div> <div class=sectline>(0 to 999).filter(palQ(_)) // <a href="/wiki/User:Alonso_del_Arte">Alonso del Arte</a>, Nov 10 2019</div> </div> </div> <div class=section> <div class=sectname>CROSSREFS</div> <div class=sectbody> <div class=sectline>Palindromes in bases 2 through 11: <a href="/A006995" title="Binary palindromes: numbers whose binary expansion is palindromic.">A006995</a> and <a href="/A057148" title="Palindromes only using 0 and 1 (i.e., base-2 palindromes).">A057148</a>, <a href="/A014190" title="Palindromes in base 3 (written in base 10).">A014190</a> and <a href="/A118594" title="Palindromes in base 3 (written in base 3).">A118594</a>, <a href="/A014192" title="Palindromes in base 4 (written in base 10).">A014192</a> and <a href="/A118595" title="Palindromes in base 4 (written in base 4).">A118595</a>, <a href="/A029952" title="Palindromic in base 5.">A029952</a> and <a href="/A118596" title="Palindromes in base 5 (written in base 5).">A118596</a>, <a href="/A029953" title="Palindromic in base 6.">A029953</a> and <a href="/A118597" title="Palindromes in base 6 (written in base 6).">A118597</a>, <a href="/A029954" title="Palindromic in base 7.">A029954</a> and <a href="/A118598" title="Palindromes in base 7 (written in base 7).">A118598</a>, <a href="/A029803" title="Numbers that are palindromic in base 8.">A029803</a> and <a href="/A118599" title="Palindromes in base 8 (written in base 8).">A118599</a>, <a href="/A029955" title="Palindromic in base 9.">A029955</a> and <a href="/A118600" title="Palindromes in base 9 (written in base 9).">A118600</a>, this sequence, <a href="/A029956" title="Numbers that are palindromic in base 11.">A029956</a>. Also <a href="/A262065" title="Numbers that are palindromes in base-60 representation.">A262065</a> (base 60), <a href="/A262069" title="Palindromes in base 10 that are also palindromes in base 60.">A262069</a> (subsequence).</div> <div class=sectline>Palindromic primes: <a href="/A002385" title="Palindromic primes: prime numbers whose decimal expansion is a palindrome.">A002385</a>. Palindromic nonprimes: <a href="/A032350" title="Palindromic nonprime numbers.">A032350</a>.</div> <div class=sectline>Palindromic-pi: <a href="/A136687" title="Number of palindromes in the range [0,n] inclusive.">A136687</a>.</div> <div class=sectline>Cf. <a href="/A029742" title="Nonpalindromic numbers.">A029742</a> (complement), <a href="/A086862" title="Differences between successive palindromes.">A086862</a> (first differences).</div> <div class=sectline>Palindromic floor function: <a href="/A261423" title="Largest palindrome &lt;= n.">A261423</a>, also <a href="/A261424" title="Difference between n and the largest palindrome &lt;= n.">A261424</a>. Palindromic ceiling: <a href="/A262038" title="Least palindrome &gt;= n.">A262038</a>.</div> <div class=sectline>Union of <a href="/A056524" title="Palindromes with even number of digits.">A056524</a> and <a href="/A056525" title="Palindromes with odd number of digits.">A056525</a>.</div> <div class=sectline>Cf. <a href="/A004086" title="Read n backwards (referred to as R(n) in many sequences).">A004086</a> (read n backwards), <a href="/A064834" title="If n (in base 10) is d_1 d_2 ... d_k then a(n) = Sum_{i = 1..[k/2] } |d_i - d_{k-i+1}|.">A064834</a>, <a href="/A118031" title="Decimal expansion of the sum of the reciprocals of the palindromic numbers A002113.">A118031</a>, <a href="/A136522" title="a(n) = 1 if n is a palindrome, otherwise 0.">A136522</a> (characteristic function), <a href="/A178788" title="Characteristic function of numbers having distinct digits in their decimal representation.">A178788</a>.</div> <div class=sectline>Ways to write n as a sum of three palindromes: <a href="/A261132" title="Number of ways to write n as the sum u+v+w of three palindromes (from A002113) with 0 &lt;= u &lt;= v &lt;= w.">A261132</a>, <a href="/A261422" title="Number of ordered triples (u,v,w) of palindromes such that u+v+w=n.">A261422</a>.</div> <div class=sectline>Minimal number of palindromes that add to n using greedy algorithm: <a href="/A088601" title="Number of steps to reach 0 when iterating A261424(x) = x - (the largest palindrome less than x), starting at n.">A088601</a>.</div> <div class=sectline>Minimal number of palindromes that add to n: <a href="/A261675" title="Minimal number of palindromes in base 10 that add to n.">A261675</a>.</div> <div class=sectline>Subsequence of <a href="/A061917" title="Either a palindrome or becomes a palindrome if trailing 0's are omitted.">A061917</a> and <a href="/A221221" title="Where powerbacks and powertrains coincide.">A221221</a>.</div> <div class=sectline>Subsequence: <a href="/A110745" title="a(n) is a number such that if odd positioned digits are deleted one gets n and if even positioned digits are deleted one get...">A110745</a>.</div> <div class=sectline>Sequence in context: <a href="/A297271" title="Numbers whose base-10 digits have equal down-variation and up-variation; see Comments.">A297271</a> <a href="/A110751" title="Numbers n such that n and its digital reversal have the same prime divisors.">A110751</a> <a href="/A147882" title="Positive integers k that are balanced, meaning that if k has d digits, then its initial ceiling(d/2) digits have the same su...">A147882</a> * <a href="/A227858" title="Numbers which start and end with the same digit in decimal.">A227858</a> <a href="/A335779" title="Curious numbers base 10.">A335779</a> <a href="/A240601" title="Recursive palindromes in base 10: palindromes n where each half of the digits of n is also a recursive palindrome.">A240601</a></div> <div class=sectline>Adjacent sequences: <a href="/A002110" title="Primorial numbers (first definition): product of first n primes. Sometimes written prime(n)#.">A002110</a> <a href="/A002111" title="Glaisher's G numbers.">A002111</a> <a href="/A002112" title="Glaisher's H numbers.">A002112</a> * <a href="/A002114" title="Glaisher's H' numbers.">A002114</a> <a href="/A002115" title="Generalized Euler numbers.">A002115</a> <a href="/A002116" title="Some special numbers.">A002116</a></div> </div> </div> <div class=section> <div class=sectname>KEYWORD</div> <div class=sectbody> <div class=sectline><span title="a sequence of nonnegative numbers">nonn</span>,<span title="dependent on base used for sequence">base</span>,<span title="it is very easy to produce terms of sequence">easy</span>,<span title="an exceptionally nice sequence">nice</span>,<span title="an important sequence">core</span>,<span title="edited within the last two weeks">changed</span></div> </div> </div> <div class=section> <div class=sectname>AUTHOR</div> <div class=sectbody> <div class=sectline><a href="/wiki/User:N._J._A._Sloane">N. J. A. Sloane</a></div> </div> </div> <div class=section> <div class=sectname>STATUS</div> <div class=sectbody> <div class=sectline>approved</div> </div> </div> </div> <div class=space10></div> </div> </div></div> <p> <div class=footerpad></div> <div class=footer> <center> <div class=bottom> <div class=linksbar> <a href="/">Lookup</a> <a href="/wiki/Welcome"><font color="red">Welcome</font></a> <a href="/wiki/Main_Page"><font color="red">Wiki</font></a> <a href="/wiki/Special:RequestAccount">Register</a> <a href="/play.html">Music</a> <a href="/plot2.html">Plot 2</a> <a href="/demo1.html">Demos</a> <a href="/wiki/Index_to_OEIS">Index</a> <a href="/webcam">WebCam</a> <a href="/Submit.html">Contribute</a> <a href="/eishelp2.html">Format</a> <a href="/wiki/Style_Sheet">Style Sheet</a> <a href="/transforms.html">Transforms</a> <a href="/ol.html">Superseeker</a> <a href="/recent">Recents</a> </div> <div class=linksbar> <a href="/community.html">The OEIS Community</a> </div> <div class=linksbar> Maintained by <a href="http://oeisf.org">The OEIS Foundation Inc.</a> </div> <div class=dbinfo>Last modified December 11 02:47 EST 2024. Contains 378602 sequences.</div> <div class=legal> <a href="/wiki/Legal_Documents">License Agreements, Terms of Use, Privacy Policy</a> </div> </div> </center> </div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10