Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Smaller prime of the set of two consecutive primes each of whose sum of digits is prime.
0

%I #18 Apr 25 2024 14:06:30

%S 2,3,5,7,23,41,43,61,83,131,137,151,173,191,193,197,223,227,263,281,

%T 311,313,317,331,353,373,397,401,443,461,463,571,593,599,601,641,643,

%U 733,751,797,821,823,827,881,883,911,971,1013,1031,1033,1091,1093,1097,1103

%N Smaller prime of the set of two consecutive primes each of whose sum of digits is prime.

%e a(5)=23 is a term because it is the first of two consecutive primes (23 and 29), each of which has a prime sum of digits: 2 + 3 = 5 and 2 + 9 = 11.

%t Select[Partition[Prime[Range[200]],2,1],PrimeQ[Total[IntegerDigits[ #[[1]]]]] && PrimeQ[Total[IntegerDigits[#[[2]]]]]&][[All,1]] (* or *) Prime[#]&/@SequencePosition[Table[If[PrimeQ[Total[IntegerDigits[n]]],1,0],{n,Prime[Range[200]]}],{1,1}][[All,1]] (* The second program requires Mathematica version 10 or later, but is more efficient because it only requires testing each prime for its sum of digits once. *) (* _Harvey P. Dale_, Jul 27 2017 *)

%t Prime@Select[Range[500], PrimeQ[Total[IntegerDigits[Prime[#]]]] && PrimeQ[Total[IntegerDigits[Prime[# + 1]]]] &] (* _César Eliud Lozada_, Mar 31 2024 *)

%K base,nonn

%O 1,1

%A _Shyam Sunder Gupta_, May 14 2005

%E Definition clarified by _Harvey P. Dale_, Jul 27 2017