login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Primes p such that the digit sums of p, p + 4 and p^2 + 4 are all prime.
1

%I #12 Sep 07 2015 14:45:28

%S 43,61,151,197,199,397,601,661,733,823,883,1051,1093,1123,1297,1381,

%T 1453,1471,1543,1831,1873,2281,2371,2551,2683,2713,2953,2971,3181,

%U 3343,3361,3583,3613,3631,4003,4153,4261,4513,4603,4621,4801,4951,5011,5101,5323,5413

%N Primes p such that the digit sums of p, p + 4 and p^2 + 4 are all prime.

%H K. D. Bajpai, <a href="/A253848/b253848.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1) = 43: 43+4 = 47; 43^2+4 = 1853. Their digit sums 4+3 = 7, 4+7 = 11 and 1+8+5+3 = 17 are all prime.

%e a(2) = 61: 61+4 = 65; 61^2+4 = 3725. Their digit sums 6+1 = 7, 6+5 = 11 and 3+7+2+5 = 17 are all prime.

%p digsum:= n -> convert(convert(n,base,10),`+`):

%p select(p -> isprime(p) and isprime(digsum(p)) and isprime(digsum(p+4)) and isprime(digsum(p^2+4)), [2,seq(2*k+1, k=1..10^4)]); # _Robert Israel_, Jan 16 2015

%t k = 4; Select[Prime[Range[1, 2000]], PrimeQ[Plus @@ IntegerDigits[#]] && PrimeQ[Plus @@ IntegerDigits[k+#]] && PrimeQ[Plus @@ IntegerDigits[k+#^2]] &]

%t Select[Prime[Range[800]],AllTrue[Total/@IntegerDigits[{#,#+4,#^2+4}], PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Aug 14 2015 *)

%o (PARI) for( n=1, 10^2, p=prime(n); k=4; if(isprime(eval(Str(sumdigits(p)))) & isprime(eval(Str(sumdigits(p+k)))) &isprime(eval(Str(sumdigits(p^2+k)))), print1(p," ",) ) )

%o (PARI) forprime(p=1,10000,if(isprime(sumdigits(p)) && isprime(sumdigits(p+4)) && isprime(sumdigits(p^2+4)),print1(p", "))) \\ _Dana Jacobsen_, Sep 07 2015

%o (Perl) use ntheory ":all"; forprimes { say if is_prime(sumdigits($_)) && is_prime(sumdigits($_+4)) && is_prime(sumdigits($_*$_+4)) } 1000; # _Dana Jacobsen_, Sep 07 2015

%Y Cf. A000040, A076162, A243586.

%K nonn,base

%O 1,1

%A _K. D. Bajpai_, Jan 16 2015