OFFSET
1,1
COMMENTS
Primes that can be written as the concatenation of two distinct primes is the same sequence.
Number of terms < 10^n: 0, 4, 48, 340, 2563, 19019, 147249, ... - T. D. Noe, Oct 04 2010
The second prime cannot begin with the digit zero, else 307 would be the first additional term. - Michael S. Branicky, Sep 01 2024
LINKS
T. D. Noe, Table of n, a(n) for n=1..10000
EXAMPLE
193 is in the sequence because it is the concatenation of the primes 19 and 3.
197 is in the sequence because it is the concatenation of the primes 19 and 7.
199 is not in the sequence because there is no way to break it into two substrings such that both are prime: neither 1 nor 99 is prime, and 19 is prime but 9 is not.
MATHEMATICA
searchMax = 10^4; Union[Reap[Do[p = Prime[i]; q = Prime[j]; n = FromDigits[Join[IntegerDigits[p], IntegerDigits[q]]]; If[PrimeQ[n], Sow[n]], {i, PrimePi[searchMax/10]}, {j, 2, PrimePi[searchMax/10^Ceiling[Log[10, Prime[i]]]]}]][[2, 1]]] (* T. D. Noe, Oct 04 2010 *)
Select[Prime@Range@1000,
MatchQ[IntegerDigits@#, {x__, y__} /;
PrimeQ@FromDigits@{x} && First@{y} != 0 &&
PrimeQ@FromDigits@{y}] &] (* Hans Rudolf Widmer, Nov 30 2024 *)
PROG
(Python)
from sympy import isprime
def ok(n):
if not isprime(n): return False
s = str(n)
return any(s[i]!="0" and isprime(int(s[:i])) and isprime(int(s[i:])) for i in range(1, len(s)))
print([k for k in range(1100) if ok(k)]) # Michael S. Branicky, Sep 01 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Lekraj Beedassy, Apr 11 2005
EXTENSIONS
Corrected and extended by Ray Chandler, Apr 16 2005
Edited by N. J. A. Sloane, May 03 2007
Edited by N. J. A. Sloane, to remove erroneous b-file, comments and Mma program, Oct 04 2010
STATUS
approved