Find the largest recurring prime
Python 3, 79 digits (probably optimal)

A simple depth first search that allows up to two consecutive zeros.



from sympy.ntheory.primetest import isprime

def dfs(n=0, k=1):
    yield n
    if 100*n &gt; k:
        yield from dfs(n, k*10)
    for i in range(1,10):
        if isprime(k*i + n):
            yield from dfs(k*i + n, k*10)

l = 1
for prime in dfs():
    if prime &gt; l:
        d = len(str(prime))
        print(f'{d} digits: {prime}')
        l = 10**d


Try it online! Validate the result!

Finds 200400201909005006060042636079002004200130030090050030780060900408062003 (72 digits) in 8 seconds on TIO. I let the program run on my computer a little longer and the highest recurrent prime it found is 7030560306007020600400306654060053003909007054300609009069003056030702030330347 (validation). The program actually completed after finding this number, so this is probably the longest prime meeting the challenges requirement.

Note that sympys isprime could theoretically return true for pseudoprimes &gt;2^64, though no examples are known as of now.



Python 3, 24 digits

only considers numbers without zeros



from sympy.ntheory.primetest import isprime

def dfs(n=0, k=1):
    yield n
    for i in range(1,10):
        if isprime(k*i + n):
            yield from dfs(k*i + n, k*10)

l = 1
for prime in dfs():
    if prime &gt; l:
        print(f'{len(str(prime))} digits: {prime}')
        l *= 10


Try it online! Validate the result!

Finds 357686312646216567629137 in less then a second on TIO.