%I #32 Sep 23 2016 11:20:28
%S 61,337,353,449,577,881,937,971,991,1091,1129,1217,1297,1381,1543,
%T 1657,1693,2069,2137,2539,2621,2791,3347,3727,3943,4157,4201,4243,
%U 4513,4861,5077,5431,5701,5927,6043,6317,6353,6421,6449,6661,6917,7109,7127,7507,7547
%N Primes p such that the concatenation of p with its digit sum and the concatenation of the digit sum of p with p are both prime.
%C Intersection of A246428 and A245759.
%H K. D. Bajpai, <a href="/A245763/b245763.txt">Table of n, a(n) for n = 1..3160</a>
%e 61 is in the sequence because it is prime; concatenation[61 with (6 + 1)] = 617 is prime and concatenation[(6 + 1) with 61] = 761 is also prime.
%e 337 is in the sequence because it is prime; concatenation[337 with (3 + 3 + 7)] = 33713 is prime and concatenation[(3 + 3 + 7) with 337] = 13337 is also prime.
%p with(StringTools): A245763 := proc() local a, b, d, e; a:=ithprime(n); b:=add( i,i = convert((a), base, 10))(a); d:=parse(cat(a, b)); e:= parse(cat(b, a)); if isprime(d)and isprime(e) then RETURN (a); fi; end: seq(A245763 (), n=1..2000);
%t cdsQ[n_]:=Module[{ds=Total[IntegerDigits[n]]},AllTrue[ {n*10^IntegerLength[ ds]+ ds, ds*10^IntegerLength[ n]+n},PrimeQ]]; Select[Prime[Range[1100]],cdsQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Sep 23 2016 *)
%o (PARI)
%o for(n=1,10^4,p=prime(n);d=Str(sumdigits(p));if(isprime(eval(concat(Str(p),d)))&&isprime(eval(concat(d,Str(p)))),print1(p,", "))) \\ _Derek Orr_, Jul 31 2014
%o (Python)
%o from sympy import prime, isprime
%o A245763 = [int(n) for n in (str(prime(x)) for x in range(1,10**3))
%o ..........if isprime(int(str(sum([int(d) for d in n]))+n)) and
%o ..........isprime(int(n+str(sum([int(d) for d in n]))))]
%o # _Chai Wah Wu_, Aug 27 2014
%Y Cf. A000040, A019518, A244424, A246428, A245759.
%K nonn,base
%O 1,1
%A _K. D. Bajpai_, Jul 31 2014