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.

A052024 Every suffix of palindromic prime a(n) is prime (left-truncatable).

This page as a plain text file.
%I A052024 #40 Feb 16 2025 08:32:41
%S A052024 2,3,5,7,313,353,373,383,797,30103,31013,70607,73037,76367,79397,
%T A052024 3002003,7096907,7693967,700090007,799636997,70060906007,
%U A052024 3000002000003,7030000000307,300000020000003,300001030100003,310000060000013,38000000000000000000083,30000000004000300040000000003,3000001000000000000000000000001000003
%N A052024 Every suffix of palindromic prime a(n) is prime (left-truncatable).
%H A052024 I. O. Angell and H. J. Godwin, <a href="http://dx.doi.org/10.1090/S0025-5718-1977-0427213-2">On Truncatable Primes</a>, Math. Comput. 31, 265-267, 1977.
%H A052024 C. K. Caldwell, <a href="https://t5k.org/glossary/page.php?sort=LeftTruncatablePrime">Left</a> and <a href="https://t5k.org/glossary/page.php?sort=RightTruncatablePrime">Right</a> truncatable primes.
%H A052024 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PrimeString.html">Prime strings</a>
%H A052024 <a href="/index/Tri#tprime">Index entries for sequences related to truncatable primes</a>
%t A052024 d[n_]:=IntegerDigits[n]; ltrQ[n_]:=And@@PrimeQ[NestWhileList[FromDigits[Drop[d[#],1]]&,n,#>9&]]; palQ[n_]:=Reverse[x=d[n]]==x; Select[Prime[Range[550000]],palQ[#]&&ltrQ[#]&] (* _Jayanta Basu_, Jun 02 2013 *)
%o A052024 (Python)
%o A052024 from sympy import isprime
%o A052024 from itertools import count, islice
%o A052024 def agen(verbose=False):
%o A052024     prime_strings, alst = {"3", "7"}, []
%o A052024     yield from [2, 3, 5, 7]
%o A052024     for digs in count(2):
%o A052024         new_prime_strings = set()
%o A052024         for p in prime_strings:
%o A052024             for d in "123456789":
%o A052024                 ts = d + "0"*(digs-1-len(p)) + p
%o A052024                 if isprime(int(ts)):
%o A052024                     new_prime_strings.add(ts)
%o A052024         prime_strings |= new_prime_strings
%o A052024         pals = [int(s) for s in new_prime_strings if s == s[::-1]]
%o A052024         yield from sorted(pals)
%o A052024         if verbose: print("...", digs, len(prime_strings), time()-time0)
%o A052024 print(list(islice(agen(), 20))) # _Michael S. Branicky_, Apr 04 2022
%Y A052024 Cf. A002385, A033664, A024785, A032437, A020994, A024770, A052023, A052025, A050986, A050987.
%K A052024 nonn,base
%O A052024 1,1
%A A052024 _G. L. Honaker, Jr._ and _Patrick De Geest_, Nov 15 1999
%E A052024 Inserted missing 31013 by _Jayanta Basu_, Jun 02 2013
%E A052024 a(27)-a(29) from _Michael S. Branicky_, Apr 04 2022