OFFSET
1,2
COMMENTS
For odd n, n^2 is odd so the two primes must be opposite in parity. Lesser prime must be 2 and greater prime must be n^2-2. Thus for odd n, n^2 is the sum of two primes iff n^2-2 is prime.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = n^2 - A106544(n).
EXAMPLE
a(2) = 2^2 = 4 = 2+2, a(5) = 5^2 = 25 = 23+2 (two primes).
a(1) = 0 because the sum of two primes is at least 4 and a(11) = 0 because 11^2 - 2 = 119 = 7*17 is composite.
MATHEMATICA
stpQ[n_]:=If[OddQ[n], PrimeQ[n^2-2], AnyTrue[n^2-Prime[Range[ PrimePi[ n^2]]], PrimeQ]]; Table[If[stpQ[n], n^2, 0], {n, 60}] (* The program uses the AnyTrue function from Mathematica version 10 *) (* Harvey P. Dale, Jul 21 2018 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Alexandre Wajnberg, May 08 2005
EXTENSIONS
Edited and extended by Klaus Brockhaus and Ray Chandler, May 12 2005
STATUS
approved