OFFSET
1,1
COMMENTS
EXAMPLE
a(1) = 31 = p^2+3pq+q^2 for p=2, q=3.
a(20) = 671 = p^2+3pq+q^2 for (p,q)=(2,23) and (5,19) is the least term to allow more than 1 decomposition. See A218795 for more such terms.
MATHEMATICA
With[{nn=60}, Take[Union[#[[1]]^2+3Times@@#+#[[2]]^2&/@Subsets[Prime[ Range[ Floor[nn/3]]], {2}]], nn]] (* Harvey P. Dale, Apr 08 2013 *)
PROG
(PARI) is_A218794(n, v=0)={ /* set v=1 to count number of decompositions, and v=2 to print them */ my(r, c=0); forprime( q=1, sqrtint((n-1)\5), issquare(4*n+5*q^2, &r) || next; isprime((r-3*q)/2) || next; v || return(1); v>1 && print1([q, (r-3*q)/2]", "); c++); c}
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Nov 05 2012
STATUS
approved