OFFSET
1,1
COMMENTS
A number can be written as a^2+b^2 if and only if it has no prime factor congruent to 3 (mod 4) raised to an odd power.
A number can be written as a^2+2*b^2 if and only if it has no prime factor congruent to 5 (mod 8) or 7 (mod 8) raised to an odd power.
A number can be written as a^2+3*b^2 if and only if it has no prime factor congruent to 2 (mod 3) raised to an odd power.
A number can be written as a^2+7*b^2 if and only if it has no prime factor congruent to 3 (mod 7) or 5 (mod 7) or 6 (mod 7) raised to an odd power. Also the power of 2 should not be 1, if it can be written in the form a^2+7*b^2.
LINKS
V. Raman, Table of n, a(n) for n = 1..1000
MATHEMATICA
nn = 4657; lim = Floor[Sqrt[nn]]; t1 = Select[Union[Flatten[Table[a^2 + b^2, {a, lim}, {b, lim}]]], # <= nn &]; t2 = Select[Union[Flatten[Table[a^2 + 2*b^2, {a, lim}, {b, lim/Sqrt[2]}]]], # <= nn &]; t3 = Select[Union[Flatten[Table[a^2 + 3*b^2, {a, lim}, {b, lim/Sqrt[3]}]]], # <= nn &]; t7 = Select[Union[Flatten[Table[a^2 + 7*b^2, {a, lim}, {b, lim/Sqrt[7]}]]], # <= nn &]; Intersection[t1, t2, t3, t7] (* T. D. Noe, Sep 08 2012 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
V. Raman, Sep 07 2012
EXTENSIONS
Definition clarified by N. J. A. Sloane, Sep 11 2012
STATUS
approved