OFFSET
1,1
LINKS
K. D. Bajpai, Table of n, a(n) for n = 1..10000
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