OFFSET
0,3
COMMENTS
a(n) <= A341701(n). a(82) = 1, are there any other n such that a(n) = 1?
Primes p such that a(p) < p: 7, 53, 73, 79, 89, 103, ...
n such that a(n) < A341701(n): 7, 10, 22, 46, 48, 53, 55, 73, ...
Similar argument as in A341716 shows that if n > 3 and a(n) >= 0, then a(n) is odd, n-a(n) !== 2 (mod 3) and n+a(n) !== 0 (mod 3).
EXAMPLE
a(7) = 3 since 76543 is prime and 765432, 7654321 are not. a(10) = 7 since 10987 is prime.
PROG
(Python)
from sympy import isprime
def A341931(n):
k, m, r = n, n-1, n if isprime(n) else -1
while m > 0:
k = int(str(k)+str(m))
if isprime(k):
r = m
m -= 1
return r
CROSSREFS
KEYWORD
sign,base
AUTHOR
Chai Wah Wu, Feb 23 2021
STATUS
approved