login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

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

%I #9 Jan 12 2020 13:48:46

%S 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,

%T 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,

%U 0,0,0,67,0,0,7,7,7,7,7,7,7,7,7,7,0,0,0,83

%N 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.

%C In other words, a(n) is the least prime prefix of n, or 0 if every prefix of n is nonprime.

%C This sequence is a variant of A331044.

%H Rémy Sigrist, <a href="/A331045/b331045.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) <= n with equality iff n = 0 or n belongs to A069090.

%F a(n) >= 0 with equality iff n belongs to A202259.

%F a(n) <= A331044(n).

%e For n = 23:

%e - 2 is a prime number,

%e - hence a(23) = 2.

%o (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)

%Y Cf. A069090, A202259, A331044.

%K nonn,base

%O 0,3

%A _Rémy Sigrist_, Jan 08 2020