login
Primes p such that p plus or minus the (sum of its digits and sum of squares of its digits) is a prime.
1

%I #4 Sep 02 2015 20:39:40

%S 23,229,239,283,359,563,599,683,809,829,853,883,1181,1217,1787,1811,

%T 1847,2069,2411,2693,2939,3329,3583,4547,4871,4877,5059,5099,5171,

%U 5683,5693,5717,6203,6269,6353,6829,7487,7541,8629,8747,9239,9283,10181

%N Primes p such that p plus or minus the (sum of its digits and sum of squares of its digits) is a prime.

%C Negative primes not permitted. - _Harvey P. Dale_, Sep 02 2015

%H Harvey P. Dale, <a href="/A179631/b179631.txt">Table of n, a(n) for n = 1..1000</a>

%e a(3)=239 since 239+(2+3+9)+(2^2+3^2+9^2)=239+14+94=347 is prime AND 239-14-94=131 is prime.

%t sdQ[n_]:=Module[{sd=Total[IntegerDigits[n]]+Total[IntegerDigits[n]^2]},sd<n&&AllTrue[n+{sd,-sd},PrimeQ]]; Select[Prime[Range[1300]],sdQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Sep 02 2015 *)

%K nonn,base

%O 1,1

%A _Carmine Suriano_, Jul 21 2010