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
Rémy Sigrist, Table of n, a(n) for n = 0..10000
FORMULA
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