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.

A077714 a(1) = 1; thereafter a(n) = the smallest prime of the form d0...0a(n-1), where d is a single digit, or 0 if no such prime exists.

Original entry on oeis.org

1, 11, 211, 4211, 34211, 234211, 4234211, 304234211, 9304234211, 209304234211, 7209304234211, 37209304234211, 3037209304234211, 23037209304234211, 323037209304234211, 70000323037209304234211, 300070000323037209304234211, 600300070000323037209304234211
Offset: 1

Views

Author

Amarnath Murthy, Nov 19 2002

Keywords

Comments

a(n) is the smallest prime obtained by prefixing a(n-1) with a number of the form d*10^k where d is a single digit, 0 < d < 10, and k >= 0. Conjecture: d*10^k always exists.

Examples

			a(8) = 304234211; deleting 3 gives 4234211 = a(7).
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; local k, m, d, p;
          if n=1 then 1 else k:= a(n-1);
            for m from length(k) do
              for d to 9 do p:= k +d*10^m;
                if isprime(p) then return p fi
            od od
          fi
        end:
    seq(a(n), n=1..20);  # Alois P. Heinz, Jan 12 2015
  • Python
    from sympy import isprime
    from itertools import islice
    def agen(an=1):
        while True:
            yield an
            pow10 = 10**len(str(an))
            while True:
                found = False
                for t in range(pow10+an, 10*pow10+an, pow10):
                    if isprime(t):
                        an = t; found = True; break
                if found: break
                pow10 *= 10
    print(list(islice(agen(), 18))) # Michael S. Branicky, Jun 23 2022

Extensions

More terms from Ray Chandler, Jul 23 2003
Offset changed to 1 by Alois P. Heinz, Jan 12 2015
Definition clarified by N. J. A. Sloane, Jan 19 2015