OFFSET
1,1
COMMENTS
EXAMPLE
17 is a term because 4^2 + 1^2 = 17 is prime and 4^2 - 1^2 = 15 is composite.
29 is a term because 5^2 + 2^2 = 29 is prime and 5^2 - 2^2 = 21 is composite.
37 is a term because 6^2 + 1^2 = 37 is prime and 6^2 - 1^2 = 35 is composite.
MATHEMATICA
lim = 50; Take[Select[Union@ Flatten@ Table[If[CompositeQ[Abs[a^2 - b^2]], a^2 + b^2, Nothing], {a, lim}, {b, lim}], PrimeQ], 56] (* Michael De Vlieger, Jan 07 2016 *)
PROG
(PARI) is(n) = {for( i=1, #n=factor(n)~%4, n[1, i]==3 && n[2, i]%2 && return); n && ( vecmin(n[1, ])==1 || (n[1, 1]==2 && n[2, 1]%2))}
f(p) = my(s=lift(sqrt(Mod(-1, p))), x=p, t); if(s>p/2, s=p-s); while(s^2>p, t=s; s=x%s; x=t); s;
forprime(p=3, 1e3, if(is(p) && !isprime(2*f(p)^2-p), print1(p, ", ")));
(PARI) list(lim) = my(v=List(), t); lim\=1; for(x=2, sqrtint(lim), for(y=1, min(sqrtint(lim-x^2), x), if(isprime(t=x^2+y^2) && !isprime(x^2-y^2), listput(v, t)))); vecsort(Vec(v), , 8)
CROSSREFS
KEYWORD
nonn
AUTHOR
Altug Alkan, Jan 07 2016
STATUS
approved