OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..1000
EXAMPLE
a(4) = 1019, because 1019 is prime and 10199 = 7 * 31 * 47, 101991 = 3 * 33997, 1019910 = 2 * 3 * 5 * 33997 and 10199101 = 11 * 927191 are composite, while no smaller 4-digit prime exhibits this property.
MATHEMATICA
ok[p_] := Block[{d = IntegerDigits@p}, d = Join[d, Reverse@ d]; And @@ CompositeQ /@ (FromDigits[d[[;; #]]] & /@ Range[Length[d]/2 + 1, Length@d])]; a[n_] := Block[{p = NextPrime[10^(n-1)]}, While[! ok[p], p = NextPrime@p]; p]; Array[a, 20] (* Giovanni Resta, Apr 11 2025 *)
PROG
(Python)
from sympy import isprime, nextprime
def c(s): # check if prime p's string of digits meets the concatenation condition
return not any(isprime(int(s:=s+c)) for c in s[::-1])
def a(n):
p = nextprime(10**(n-1))
while not c(str(p)): p = nextprime(p)
return p
print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Apr 16 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jean-Marc Rebert, Apr 11 2025
STATUS
approved
