OFFSET
1,1
COMMENTS
EXAMPLE
a(1) = 2 since 1^2 + 2^2 = 5 is prime.
a(2) = 3 since 2^2 + 2^2 = 8 is not prime but 2^2 + 3^2 = 13 is prime.
a(9) = 0 since 9^2 + 2^2 = 85 is not prime.
MATHEMATICA
f[n_] := If[OddQ[n] && ! PrimeQ[n^2 + 4], 0,
Block[{p = 2}, While[! PrimeQ[n^2 + p^2] && p < 1500, p = NextPrime@p];
p]]; Array[f, 100]
CROSSREFS
KEYWORD
nonn
AUTHOR
Jonathan Sondow and Robert G. Wilson v, Nov 06 2015
STATUS
approved