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.

A111383 Beginning with 3, least member of A007500 such that concatenation of first n terms and its digit reversal both are primes.

Original entry on oeis.org

3, 7, 3, 3, 79, 701, 157, 1103, 11959, 1901, 10273, 92753, 17047, 11909, 144973, 327251, 99289, 92831, 90373, 309671, 1149619, 745397, 1232083, 94793, 18481, 76607, 186649, 181421, 1657561, 3746111, 7067239, 324143, 3185263, 9457181, 1703413, 3517583, 72481, 12859481
Offset: 1

Views

Author

Hans Havermann, Nov 08 2005

Keywords

Crossrefs

Programs

  • Python
    from gmpy2 import digits, is_prime, mpz
    from itertools import count, islice, product
    def bgen(): # generator of terms of A007500 -{2, 5} as strings
        yield from "37"
        p = 11
        for digits in count(2):
            for first in "1379":
                for mid in product("0123456789", repeat=digits-2):
                    for last in "1379":
                        s = first + "".join(mid) + last
                        if is_prime(mpz(s)) and is_prime(mpz(s[::-1])):
                            yield s
    def agen(): # generator of terms
        s, r, an, san = "", "", 3, "3"
        while True:
            yield int(an)
            s, r = s+san, san[::-1]+r
            for san in bgen():
                if is_prime(mpz(s+san)) and is_prime(mpz(san[::-1]+r)):
                    break
            an = mpz(san)
    print(list(islice(agen(), 34))) # Michael S. Branicky, Jan 02 2025

Extensions

a(35) and beyond from Michael S. Branicky, Jan 02 2025