login
Primes p such that concatenation of the digit sum of p with p is also prime.
3

%I #31 Jan 12 2015 17:24:04

%S 11,19,23,29,31,41,43,53,59,61,67,89,97,113,149,151,163,173,181,211,

%T 229,233,271,293,317,331,337,347,349,353,359,379,389,419,431,433,443,

%U 449,463,467,479,521,547,563,577,599,613,619,631,653,673,683,691,739,751

%N Primes p such that concatenation of the digit sum of p with p is also prime.

%H K. D. Bajpai, <a href="/A246428/b246428.txt">Table of n, a(n) for n = 1..9400</a>

%e 23 is in the sequence because it is prime; concatenation[(2 + 3) with 23 = 523, which is also prime.

%e 59 is in the sequence because it is prime; concatenation[(5 + 9) with 59 = 1459, which is also prime.

%p with(StringTools): A246428 := proc() local a, b, d, e; a:=ithprime(m); b:=add( i, i = convert((a), base, 10))(a); d:=parse(cat(a, b)); e:= parse(cat(b, a)); if isprime(e) then RETURN (a); fi; end:

%p seq(A246428 (), m=1..300);

%t a245758[n_Integer] := Cases[Map[If[PrimeQ[FromDigits[Flatten[Append[List[Total[ IntegerDigits[ Prime[#]]]], IntegerDigits[Prime[#]]]]]] == True, Prime[#]]]], [#], False] &, Range[n]], _Integer]; a245758[135] (* _Michael De Vlieger_, Aug 07 2014 *)

%t Select[Prime[Range[200]],PrimeQ[FromDigits[Flatten[Join[{ IntegerDigits[ Total[ IntegerDigits[#]]], IntegerDigits[#]}]]]]&] (* _Harvey P. Dale_, Jan 12 2015 *)

%o (PARI)

%o for(n=1, 10^3, p=prime(n); if(isprime(eval(concat(Str(sumdigits(p)), Str(p)))), print1(p, ", "))) \\ _Derek Orr_, Jul 31 2014

%o (Python)

%o from sympy import prime, isprime

%o A246428 = [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))]

%o # _Chai Wah Wu_, Aug 27 2014

%Y Cf. A245759, A245763.

%K nonn,base

%O 1,1

%A _K. D. Bajpai_, Jul 31 2014