OFFSET
0,1
COMMENTS
Digits can be prepended or appended. Any leading 0 digits upon prepending or removal of the first digit are discarded.
The condition a(n) != n is the same as disallowing prepending by zero in A389929. First differs from A389929 at a(2) = 23 != 2 = A389929(2).
a(9387527) = 0 is the first prime p with a(p) = 0.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..10000
FORMULA
a(p) > p or 0 for p in A125001.
EXAMPLE
a(2) = 23 since deletiing and prepending cannot produce a prime and 21 and 22 are composite.
PROG
(Python)
from gmpy2 import is_prime
def a(n):
s = str(n)
D = set(p for i in range(len(s)) if len(t:=s[:i]+s[i+1:]) and is_prime(p:=int(t)))
if D: return min(D)
A = set(p for i in range(len(s)+1) for d in "0123456789" if not (i==0 and d=='0') and is_prime(p:=int(s[:i]+d+s[i:])))
return min(A, default=0)
print([a(n) for n in range(76)])
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Michael S. Branicky, Oct 22 2025
STATUS
approved
