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.

A331045 a(n) is the least prime number of the form floor(n/10^k) for some k >= 0, or 0 if no such prime number exists.

Original entry on oeis.org

0, 0, 2, 3, 0, 5, 0, 7, 0, 0, 0, 11, 0, 13, 0, 0, 0, 17, 0, 19, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 41, 0, 43, 0, 0, 0, 47, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 61, 0, 0, 0, 0, 0, 67, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 83
Offset: 0

Views

Author

Rémy Sigrist, Jan 08 2020

Keywords

Comments

In other words, a(n) is the least prime prefix of n, or 0 if every prefix of n is nonprime.
This sequence is a variant of A331044.

Examples

			For n = 23:
- 2 is a prime number,
- hence a(23) = 2.
		

Crossrefs

Programs

  • PARI
    a(n, base=10) = my (d=digits(n, base), p=0); for (k=1, #d, if (isprime(p=base*p+d[k]), return (p))); return (0)

Formula

a(n) <= n with equality iff n = 0 or n belongs to A069090.
a(n) >= 0 with equality iff n belongs to A202259.
a(n) <= A331044(n).