CINXE.COM
A016038 - 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>A016038 - OEIS</title> <link rel="search" type="application/opensearchdescription+xml" title="OEIS" href="/oeis.xml"> <script> var myURL = "\/A016038" 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=%2fA016038">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="A016038 - OEIS"></a> </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> A016038 </div> <div class=seqname> Strictly non-palindromic numbers: n is not palindromic in any base b with 2 <= b <= n-2. </div> </div> <div class=scorerefs> 22 </div> </div> <div> <div class=seqdatabox> <div class=seqdata>0, 1, 2, 3, 4, 6, 11, 19, 47, 53, 79, 103, 137, 139, 149, 163, 167, 179, 223, 263, 269, 283, 293, 311, 317, 347, 359, 367, 389, 439, 491, 563, 569, 593, 607, 659, 739, 827, 853, 877, 977, 983, 997, 1019, 1049, 1061, 1187, 1213, 1237, 1367, 1433, 1439, 1447, 1459</div> <div class=seqdatalinks> (<a href="/A016038/list">list</a>; <a href="/A016038/graph">graph</a>; <a href="/search?q=A016038+-id:A016038">refs</a>; <a href="/A016038/listen">listen</a>; <a href="/history?seq=A016038">history</a>; <a href="/search?q=id:A016038&fmt=text">text</a>; <a href="/A016038/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>All elements of the sequence greater than 6 are prime (ab = a(b-1) + a or a^2 = (a-1)^2 + 2(a-1) + 1). Mersenne and Fermat primes are not in the sequence.</div> <div class=sectline>Additional comments: if you can factor a number as a*b then it is a palindrome in base b-1, where b is the larger of the two factors. (If the number is a square, then it can be a palindrome in an additional way, in base (sqrt(n)-1)). The a*b form does not work when a = b-1, but of course there are no two consecutive primes (other than 2,3, which explains the early special cases), so if you can factor a number as a*(a-1), then another factorization also exists. - Michael B Greenwald (mbgreen(AT)central.cis.upenn.edu), Jan 01 2002</div> <div class=sectline>Note that no prime p is palindromic in base b for the range sqrt(p) < b < p-1. Hence to find non-palindromic primes, we need only examine bases up to floor(sqrt(p)), which greatly reduces the computational effort required. - <a href="/wiki/User:T._D._Noe">T. D. Noe</a>, Mar 01 2008</div> <div class=sectline>No number n is palindromic in any base b with n/2 <= b <= n-2, so this is also numbers not palindromic in any base b with 2 <= b <= n/2.</div> <div class=sectline>Sequence <a href="/A047811" title="Numbers n >= 4 that are not palindromic in any base b, 2 <= b <= n/2.">A047811</a> (this sequence without 0, 1, 2, 3) is mentioned in the Guy paper, in which he reports on unsolved problems. This problem came from Mario Borelli and Cecil B. Mast. The paper poses two questions about these numbers: (1) Can palindromic or nonpalindromic primes be otherwise characterized? and (2) What is the cardinality, or the density, of the set of palindromic primes? Of the set of nonpalindromic primes? - <a href="/wiki/User:T._D._Noe">T. D. Noe</a>, Apr 18 2011</div> <div class=sectline>From <a href="/wiki/User:Robert_G._Wilson_v">Robert G. Wilson v</a>, Oct 22 2014 and Nov 03 2014: (Start)</div> <div class=sectline>Define f(n) to be the number of palindromic representations of n in bases b with 1 < b < n, see <a href="/A135551" title="Number of bases b, 1 < b < n, in which n is a palindrome.">A135551</a>.</div> <div class=sectline>For <a href="/A016038" title="Strictly non-palindromic numbers: n is not palindromic in any base b with 2 <= b <= n-2.">A016038</a>, f(n) = 1 for all n. Only the numbers n = 0, 1, 4 and 6 are not primes.</div> <div class=sectline>For f(n) = 2, all terms are prime or semiprimes (prime omega <= 2 (<a href="/A037143" title="Numbers with at most 2 prime factors (counted with multiplicity).">A037143</a>)) with the exception of 8 and 12;</div> <div class=sectline>For f(n) = 3, all terms are at most 3-almost primes (prime omega <= 3 (<a href="/A037144" title="Numbers with at most 3 prime factors (counted with multiplicity).">A037144</a>)), with the exception of 16, 32, 81 and 625;</div> <div class=sectline>For f(n) = 4, all terms are at most 4-almost primes, with the exception of 64 and 243;</div> <div class=sectline>For f(n) = 5, all terms are at most 5-almost primes, with the exception of 128, 256 and 729;</div> <div class=sectline>For f(n) = 6, all terms are at most 6-almost primes, with the sole exception of 2187;</div> <div class=sectline>For f(n) = 7, all terms are at most 7-almost primes, with the exception of 512, 2048 and 19683; etc. (End)</div> </div> </div> <div class=section> <div class=sectname>REFERENCES</div> <div class=sectbody> <div class=sectline>Paul Guinand, Strictly non-palindromic numbers, unpublished note, 1996.</div> </div> </div> <div class=section> <div class=sectname>LINKS</div> <div class=sectbody> <div class=sectline>T. D. Noe, <a href="/A016038/b016038.txt">Table of n, a(n) for n = 1..10001</a></div> <div class=sectline>K. S. Brown, <a href="http://www.mathpages.com/home/kmath359.htm">On General Palindromic Numbers</a></div> <div class=sectline>Patrick De Geest, <a href="http://www.worldofnumbers.com/nobase10.htm">Palindromic numbers beyond base 10</a></div> <div class=sectline>R. K. Guy, <a href="http://www.jstor.org/stable/2325149">Conway's RATS and other reversals</a>, Amer. Math. Monthly, 96 (1989), 425-428.</div> <div class=sectline>John P. Linderman, <a href="/A135549/a135549.html">Description of A135549-A016038</a></div> <div class=sectline>John P. Linderman, <a href="/A135549/a135549.txt">Perl program</a> [Use the command: HASNOPALINS=1 palin.pl]</div> </div> </div> <div class=section> <div class=sectname>FORMULA</div> <div class=sectbody> <div class=sectline>a(n) = <a href="/A047811" title="Numbers n >= 4 that are not palindromic in any base b, 2 <= b <= n/2.">A047811</a>(n-4) for n > 4. - <a href="/wiki/User:M._F._Hasler">M. F. Hasler</a>, Sep 08 2015</div> </div> </div> <div class=section> <div class=sectname>MATHEMATICA</div> <div class=sectbody> <div class=sectline>PalindromicQ[n_, base_] := FromDigits[Reverse[IntegerDigits[n, base]], base] == n; PalindromicBases[n_] := Select[Range[2, n-2], PalindromicQ[n, # ] &]; StrictlyPalindromicQ[n_] := PalindromicBases[n] == {}; Select[Range[150], StrictlyPalindromicQ] (* <a href="/wiki/User:Herman_Beeksma">Herman Beeksma</a>, Jul 16 2005*)</div> <div class=sectline>palindromicBases[n_] := Module[{p}, Table[p = IntegerDigits[n, b]; If[ p == Reverse[p], {b, p}, Sequence @@ {}], {b, 2, n - 2}]]; lst = {0, 1, 4, 6}; Do[ If[ Length@ palindromicBases@ Prime@n == 0, AppendTo[lst, Prime@n]], {n, 10000}]; lst (* <a href="/wiki/User:Robert_G._Wilson_v">Robert G. Wilson v</a>, Mar 08 2008 *)</div> <div class=sectline>Select[Range@ 1500, Function[n, NoneTrue[Range[2, n - 2], PalindromeQ@ IntegerDigits[n, #] &]]] (* <a href="/wiki/User:Michael_De_Vlieger">Michael De Vlieger</a>, Dec 24 2017 *)</div> </div> </div> <div class=section> <div class=sectname>PROG</div> <div class=sectbody> <div class=sectline>(PARI) is(n)=!for(b=2, n\2, Vecrev(d=digits(n, b))==d&&return) \\ <a href="/wiki/User:M._F._Hasler">M. F. Hasler</a>, Sep 08 2015</div> <div class=sectline>(Python)</div> <div class=sectline>from itertools import count, islice</div> <div class=sectline>from sympy.ntheory.factor_ import digits</div> <div class=sectline>def <a href="/A016038" title="Strictly non-palindromic numbers: n is not palindromic in any base b with 2 <= b <= n-2.">A016038</a>_gen(startvalue=0): # generator of terms >= startvalue</div> <div class=sectline> return filter(lambda n: all((s := digits(n, b)[1:])[:(t:=len(s)+1>>1)]!=s[:-t-1:-1] for b in range(2, n-1)), count(max(startvalue, 0)))</div> <div class=sectline><a href="/A016038" title="Strictly non-palindromic numbers: n is not palindromic in any base b with 2 <= b <= n-2.">A016038</a>_list = list(islice(<a href="/A016038" title="Strictly non-palindromic numbers: n is not palindromic in any base b with 2 <= b <= n-2.">A016038</a>_gen(), 30)) # <a href="/wiki/User:Chai_Wah_Wu">Chai Wah Wu</a>, Jan 17 2024</div> </div> </div> <div class=section> <div class=sectname>CROSSREFS</div> <div class=sectbody> <div class=sectline>Cf. <a href="/A047811" title="Numbers n >= 4 that are not palindromic in any base b, 2 <= b <= n/2.">A047811</a>, <a href="/A050812" title="Number of times n is palindromic in bases b, 2 <= b <= 10.">A050812</a>, <a href="/A050813" title="Numbers n not palindromic in any base b, 2 <= b <= 10.">A050813</a>, <a href="/A037183" title="Smallest number that is palindromic (with at least 2 digits) in n bases.">A037183</a>, <a href="/A135550" title="Number of bases b, 1 < b < n-1, in which n is a palindrome, allowing leading zeros when testing if a number is a palindrome.">A135550</a>, <a href="/A135551" title="Number of bases b, 1 < b < n, in which n is a palindrome.">A135551</a>, <a href="/A135549" title="Number of bases b, 1 < b < n-1, in which n is a palindrome.">A135549</a>, <a href="/A138348" title="Lesser of twin primes such that both twin primes have no bases b, 1 < b < p-1, in which p is a palindrome.">A138348</a>.</div> <div class=sectline>Sequence in context: <a href="/A117308" title="Numbers k for which (phi(k))^2 + phi(k) + 1 is a palindrome.">A117308</a> <a href="/A114412" title="Records in semiprime gaps ordered by merit.">A114412</a> <a href="/A352819" title="G.f. A(x) satisfies: 1 - x = Sum_{n>=0} (x^(3*n) + (-1)^n*A(x))^n.">A352819</a> * <a href="/A003099" title="a(n) = Sum_{k=0..n} binomial(n,k^2).">A003099</a> <a href="/A375169" title="Expansion of (1 - x) / ((1 - x)^3 - x^4).">A375169</a> <a href="/A061941" title="Numbers n such that n divides the (right) concatenation of all numbers <= n written in base 12 (most significant digit on ri...">A061941</a></div> <div class=sectline>Adjacent sequences: <a href="/A016035" title="a(n) = Sum_{j|n, 1 < j < n} phi(j). Also a(n) = n - phi(n) - 1 for n > 1.">A016035</a> <a href="/A016036" title="Row sums of triangle A000369.">A016036</a> <a href="/A016037" title="Map numbers to number of letters in English name; sequence gives number of steps to converge (to 4).">A016037</a> * <a href="/A016039" title="Inverse of 2030th cyclotomic polynomial.">A016039</a> <a href="/A016040" title="Integer part of Chebyshev's theta function: floor( log(Product_{k=1..n} prime(k)) ).">A016040</a> <a href="/A016041" title="Primes that are palindromic in base 2 (but written here in base 10).">A016041</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="an exceptionally nice sequence">nice</span>,<span title="it is very easy to produce terms of sequence">easy</span></div> </div> </div> <div class=section> <div class=sectname>AUTHOR</div> <div class=sectbody> <div class=sectline><a href="/wiki/User:Robert_G._Wilson_v">Robert G. Wilson v</a></div> </div> </div> <div class=section> <div class=sectname>EXTENSIONS</div> <div class=sectbody> <div class=sectline>Extended and corrected by <a href="/wiki/User:Patrick_De_Geest">Patrick De Geest</a>, Oct 15 1999</div> <div class=sectline>Edited by <a href="/wiki/User:N._J._A._Sloane">N. J. A. Sloane</a>, Apr 09 2008</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 February 26 12:57 EST 2025. Contains 381235 sequences.</div> <div class=legal> <a href="/wiki/Legal_Documents">License Agreements, Terms of Use, Privacy Policy</a> </div> </div> </center> </div> </body> </html>