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.

A087155 Primes having nontrivial palindromic representation in some (at least one) base.

This page as a plain text file.
%I A087155 #42 Feb 24 2023 16:01:31
%S A087155 5,7,13,17,23,29,31,37,41,43,59,61,67,71,73,83,89,97,101,107,109,113,
%T A087155 127,131,151,157,173,181,191,193,197,199,211,227,229,233,239,241,251,
%U A087155 257,271,277,281,307,313,331,337,349,353,373,379,383,397,401,409,419
%N A087155 Primes having nontrivial palindromic representation in some (at least one) base.
%C A087155 Number of terms < 10^n: 2, 18, 129, 1010, 8392, ..., . - _Robert G. Wilson v_, Jun 19 2014
%C A087155 Every whole number has single-digit representation in all large bases and all greater than 2 have representation 11 in the base one less than itself. Other palindromic representations are the nontrivial ones. - _James G. Merickel_, Jul 25 2015
%C A087155 Primes not in A016038. - _Robert Israel_, Jul 27 2015
%H A087155 Robert G. Wilson v, <a href="/A087155/b087155.txt">Table of n, a(n) for n = 1..10000</a>
%e A087155 17 is in the list because 17_2 = 10001 and 17_4 = 101, two nontrivial palindromic representations. 19 is not in the list because 19 is not a multidigit palindrome in any base other than base 18.
%p A087155 filter:= proc(n) local b,L;
%p A087155 if not isprime(n) then return false fi;
%p A087155 for b from 2 to floor(sqrt(n)) do
%p A087155   L:= convert(n,base,b);
%p A087155   if L = ListTools:-Reverse(L) then return true fi;
%p A087155 od:
%p A087155 false
%p A087155 end proc:
%p A087155 select(filter, [2*i+1 $ i=1..1000]); # _Robert Israel_, Jul 27 2015
%t A087155 palindromicBases[n_] := Module[{p}, Table[p = IntegerDigits[n, b]; If[p == Reverse[p], {b, p}, Sequence @@ {}], {b, 2, n - 2}]]; Select[ Prime@ Range@ 300, palindromicBases[#] !={}&] (* _Robert G. Wilson v_, May 06 2014 *)
%o A087155 (PARI) q=1; forprime(m=3,500,count=0; for(b=2,m-1, w=b+1; k=0; i=m; while(i>0,k=k*w+i%b; i=floor(i/b)); l=0; j=k; while(j>0,l=l*w+j%w; j=floor(j/w)); if(l==k,count=count+1; if(count>1,print1(m,", "); q=b; m=nextprime(m+1); q=1; b=1,q=b),)))
%Y A087155 Cf. A016038.
%K A087155 base,nonn
%O A087155 1,1
%A A087155 _Randy L. Ekl_, Oct 18 2003
%E A087155 Title, comments and example changed to agree with convention on single-digit numbers and incorporate 'nontrivial' concept by _James G. Merickel_, Jul 25 2015