login
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.
3
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,3
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.
LINKS
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).
EXAMPLE
For n = 23:
- 2 is a prime number,
- hence a(23) = 2.
PROG
(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)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jan 08 2020
STATUS
approved