login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A341701
a(n) = largest m > 0 such that the decimal concatenation n||n-1||n-2||...||m is prime, or -1 if no such prime exists.
4
-1, -1, 2, 3, 3, 5, -1, 7, -1, -1, 9, 11, -1, 13, -1, -1, -1, 17, -1, 19, -1, -1, 21, 23, 23, 13, -1, 23, -1, 29, -1, 31, -1, -1, 33, -1, -1, 37, -1, -1, -1, 41, 41, 43, -1, -1, 39, 47, 41, -1, -1, 47, 37, 53, -1, 43, 47, -1, 57, 59, 47, 61, -1, -1, -1, -1, -1
OFFSET
0,3
COMMENTS
A variant of A341717. a(82) = 1. Are there other n such that a(n) = 1?
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).
FORMULA
a(p) = p if and only if p is prime.
EXAMPLE
a(4) = 3 since 43 is prime, a(25) = 13 since 25242322212019181716151413 is prime.
PROG
(Python)
from sympy import isprime
def A341701(n):
k, m = n, n-1
while not isprime(k) and m > 0:
k = int(str(k)+str(m))
m -= 1
return m+1 if isprime(k) else -1
CROSSREFS
KEYWORD
sign,base
AUTHOR
Chai Wah Wu, Feb 23 2021
STATUS
approved