OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..1000
EXAMPLE
a(1) = 2, because 2 is prime, 22 = 2*11 is composite, while no smaller one-digit prime exhibits this property.
a(2) = 11, because 11 is prime, 111 = 3*37 and 1111 = 11*101 are composite, while no smaller two-digit prime exhibits this property.
a(4) = 1013, because 1013 is prime, 10131 = 3 * 11 * 30, 101310 = 2 * 3 * 5 * 11 * 307, 1013101 = 227 * 4463 and 10131013 = 73 * 137 * 1013 are composite, while no smaller 4-digit prime exhibits this property.
PROG
(PARI) isok(p, n) = my(d=digits(p)); for (i=1, #d, p = 10*p+d[i]; if (isprime(p), return(0)); ); return(1);
a(n) = my(p=nextprime(10^(n-1))); while (!isok(p, n), p = nextprime(p+1)); p; \\ Michel Marcus, Apr 09 2025
(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)
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 09 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jean-Marc Rebert, Apr 08 2025
STATUS
approved
