A216513 Number of nonnegative integer solutions to the equation x^2 + 6*y^2 = n.
1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 2, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 2, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0
Offset: 0
Keywords
Crossrefs
Cf. A002481.
Programs
-
Mathematica
r[n_] := Reduce[x >= 0 && y >= 0 && x^2 + 6 y^2 == n, Integers]; a[n_] := Which[rn = r[n]; rn === False, 0, Head[rn] === And, 1, Head[rn] === Or, Length[rn], True, -1]; Table[a[n], {n, 0, 99}] (* Jean-François Alcover, Jun 24 2017 *)
Extensions
Verified by N. J. A. Sloane, Sep 10 2012
a(96) and a(97) corrected by Jean-François Alcover, Jun 24 2017