login
Primes with an even number of digits such that the first half of the digits and the second half of the digits are both primes.
3

%I #15 Jul 19 2015 03:32:03

%S 23,37,53,73,1103,1117,1123,1129,1153,1171,1303,1307,1319,1361,1367,

%T 1373,1723,1741,1747,1753,1759,1783,1789,1907,1913,1931,1973,1979,

%U 1997,2311,2341,2347,2371,2383,2389,2903,2917,2953,2971,3119,3137

%N Primes with an even number of digits such that the first half of the digits and the second half of the digits are both primes.

%C The number of terms with 2, 4, 6, ... digits: 4, 92, 3223, 130607, 6350300, ..., . - _Robert G. Wilson v_, Dec 07 2008

%D P. Giannopoulos, The brainteasers (unpublished)

%H Robert G. Wilson v, <a href="/A080906/b080906.txt">Table of n, for n = 1..10000</a>. [From _Robert G. Wilson v_, Dec 07 2008]

%e 23 is a member because 2 and 3 are both primes.

%t f[n_] := Block[{c = 0, lp = PrimePi[10^n] - PrimePi[10^(n - 1)], lq = PrimePi[10^n], lst = {}, pq, p = Prime@ Range[PrimePi[10^(n - 1)] + 1, PrimePi[10^n]], q = Prime@ Range[1, PrimePi[10^n]]}, Do[pq = p[[i]]*10^n + q[[j]]; If[PrimeQ@ pq, AppendTo[lst, pq]; c++ ], {i, lp}, {j, lq}]; lst]; Array[f, 2] // Flatten (* _Robert G. Wilson v_, Dec 07 2008 *)

%t pQ[n_]:=Module[{idn=IntegerDigits[n],len},len=Length[idn];EvenQ[len] && PrimeQ[FromDigits[Take[idn,len/2]]]&&PrimeQ[FromDigits[Take[idn, -len/2]]]]; Select[Prime[Range[500]],pQ] (* _Harvey P. Dale_, Nov 08 2011 *)

%o (PARI) t=1; forprime( p=2,99, if( p>t, t*=10); forprime( q=3,t, isprime(p*t+q) & print1(p*t+q,", "))) \\ _M. F. Hasler_

%Y Cf. A000040. - _Robert G. Wilson v_, Dec 07 2008

%K base,easy,nonn

%O 1,1

%A P. Giannopoulos (pgiannop1(AT)yahoo.com), Mar 31 2003

%E Corrected by _Zak Seidov_, _Robert Israel_, _Farideh Firoozbakht_ and _M. F. Hasler_, Dec 06 2008 and Dec 07 2008

%E Edited by _N. J. A. Sloane_, Dec 07 2008