login
A253848
Primes p such that the digit sums of p, p + 4 and p^2 + 4 are all prime.
1
43, 61, 151, 197, 199, 397, 601, 661, 733, 823, 883, 1051, 1093, 1123, 1297, 1381, 1453, 1471, 1543, 1831, 1873, 2281, 2371, 2551, 2683, 2713, 2953, 2971, 3181, 3343, 3361, 3583, 3613, 3631, 4003, 4153, 4261, 4513, 4603, 4621, 4801, 4951, 5011, 5101, 5323, 5413
OFFSET
1,1
LINKS
EXAMPLE
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.
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.
MAPLE
digsum:= n -> convert(convert(n, base, 10), `+`):
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
MATHEMATICA
k = 4; Select[Prime[Range[1, 2000]], PrimeQ[Plus @@ IntegerDigits[#]] && PrimeQ[Plus @@ IntegerDigits[k+#]] && PrimeQ[Plus @@ IntegerDigits[k+#^2]] &]
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 *)
PROG
(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, " ", ) ) )
(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
(Perl) use ntheory ":all"; forprimes { say if is_prime(sumdigits($_)) && is_prime(sumdigits($_+4)) && is_prime(sumdigits($_*$_+4)) } 1000; # Dana Jacobsen, Sep 07 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
K. D. Bajpai, Jan 16 2015
STATUS
approved