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.

Showing 1-1 of 1 results.

A068160 Smallest prime beginning and ending in exactly n 1's and containing at least one digit != 1.

Original entry on oeis.org

2, 101, 11311, 1114111, 111181111, 111110611111, 1111118111111, 111111151111111, 111111110911111111, 11111111128111111111, 111111111161111111111, 111111111110911111111111, 11111111111104111111111111, 1111111111111031111111111111, 11111111111111611111111111111, 11111111111111173111111111111111
Offset: 0

Views

Author

Amarnath Murthy, Feb 24 2002

Keywords

Comments

a(499) has 1001 digits. - Michael S. Branicky, Oct 02 2024

Examples

			a(2) = 11311 is a prime that starts with 11 and ends in 11 (two 1's).
		

Crossrefs

Cf. A366416.

Programs

  • Python
    from gmpy2 import is_prime
    def a(n):
        suffix, d = (10**n-1)//9, 2*n+1
        while True:
            prefix = 10**(d-n)*suffix
            for mid in range(0, 10**(d-n), 10**n):
                s = str(mid//10**n)
                if s[0] == "1" or s[-1] == "1": continue
                t = prefix + mid + suffix
                if is_prime(t): return t
            d += 1
    print([a(n) for n in range(16)]) # Michael S. Branicky, Oct 02 2024

Extensions

Corrected and extended by Sascha Kurz, Jan 03 2003
More precise name and more terms from Hugo Pfoertner, Oct 11 2023
a(0) = 2 inserted by Michael S. Branicky, Oct 02 2024
Showing 1-1 of 1 results.