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.

A372141 Primes p that are palindromic in some prime base q, where q < p.

This page as a plain text file.
%I A372141 #30 May 13 2024 15:36:46
%S A372141 3,5,7,13,17,23,31,41,67,71,73,83,107,109,127,151,157,173,199,233,257,
%T A372141 271,277,307,313,353,379,409,419,421,431,443,457,499,521,523,571,587,
%U A372141 599,601,631,643,647,653,691,701,709,719,733,743,757,787,797,809,823,829,857,863,887
%N A372141 Primes p that are palindromic in some prime base q, where q < p.
%C A372141 If we remove either constraint of q < p or q being prime, then the sequence would be all prime numbers (A000040).
%C A372141 By definition it is a superset of A016041, and is a proper superset by construction (e.g., 13 is in the sequence).
%C A372141 Some terms have multiple bases that yield palindromic representations, the first being 31 (which is palindromic in both base 2 and base 5). The smallest prime p such that there exist n distinct primes less than p that give palindromic representations of p is A372142(n).
%H A372141 Chai Wah Wu, <a href="/A372141/b372141.txt">Table of n, a(n) for n = 1..11371</a> (terms 1..1000 from Tadayoshi Kamegai)
%e A372141 11 is not in this sequence as its representation in base 2 is 1011, in base 3 is 102, in base 5 is 21, in base 7 is 14, none of which are palindromic.
%e A372141 1483 is in this sequence as its representation in base 37 is 131, which is palindromic.
%t A372141 a={}; For[i=1, i<=155, i++, flag=0; For[j=1, Prime[j] < Prime[i] && flag==0, j++, If[PalindromeQ[IntegerDigits[Prime[i], Prime[j]]], flag=1; AppendTo[a, Prime[i]]]]]; a (* _Stefano Spezia_, Apr 22 2024 *)
%o A372141 (Python)
%o A372141 from sympy import sieve
%o A372141 from sympy.ntheory import digits
%o A372141 from itertools import islice
%o A372141 def ispal(v): return v == v[::-1]
%o A372141 def agen(): yield from (p for p in sieve if any(ispal(digits(p, q)[1:]) for q in sieve.primerange(1, p)))
%o A372141 print(list(islice(agen(), 60))) # _Michael S. Branicky_, Apr 20 2024
%Y A372141 Cf. A372142, A002385, A002113.
%Y A372141 Cf. A007500, A016041, A077798.
%K A372141 nonn,base
%O A372141 1,1
%A A372141 _Tadayoshi Kamegai_, Apr 20 2024