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).

Original entry on oeis.org

2, 3, 5, 7, 313, 353, 373, 383, 797, 30103, 31013, 70607, 73037, 76367, 79397, 3002003, 7096907, 7693967, 700090007, 799636997, 70060906007, 3000002000003, 7030000000307, 300000020000003, 300001030100003, 310000060000013, 38000000000000000000083, 30000000004000300040000000003, 3000001000000000000000000000001000003
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    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[#]&<rQ[#]&] (* Jayanta Basu, Jun 02 2013 *)
  • Python
    from sympy import isprime
    from itertools import count, islice
    def agen(verbose=False):
        prime_strings, alst = {"3", "7"}, []
        yield from [2, 3, 5, 7]
        for digs in count(2):
            new_prime_strings = set()
            for p in prime_strings:
                for d in "123456789":
                    ts = d + "0"*(digs-1-len(p)) + p
                    if isprime(int(ts)):
                        new_prime_strings.add(ts)
            prime_strings |= new_prime_strings
            pals = [int(s) for s in new_prime_strings if s == s[::-1]]
            yield from sorted(pals)
            if verbose: print("...", digs, len(prime_strings), time()-time0)
    print(list(islice(agen(), 20))) # Michael S. Branicky, Apr 04 2022

Extensions

Inserted missing 31013 by Jayanta Basu, Jun 02 2013
a(27)-a(29) from Michael S. Branicky, Apr 04 2022