This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A006371 M0207 #28 Jun 01 2025 10:04:06 %S A006371 1,1,1,1,1,2,2,2,1,2,3,2,2,2,3,3,2,3,4,2,1,4,5,4,2,2,4,4,3,4,5,4,1,4, %T A006371 7,3,3,4,5,6,3,4,6,2,2,6,8,6,3,3,5,6,3,6,8,4,2,6,10,4,2,6,5,7,5,4,8,4, %U A006371 3,8,10,8,3,2,7,6,4,8,10,6,1,8 %N A006371 Number of positive definite reduced binary quadratic forms of discriminant -A014601(n). %D A006371 H. Davenport, The Higher Arithmetic. Cambridge Univ. Press, 5th edition, 1982, p. 144. %D A006371 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %H A006371 Robin Visser, <a href="/A006371/b006371.txt">Table of n, a(n) for n = 1..10000</a> %H A006371 Rick L. Shepherd, <a href="http://libres.uncg.edu/ir/uncg/f/Shepherd_uncg_0154M_11099.pdf">Binary quadratic forms and genus theory</a>, Master of Arts Thesis, University of North Carolina at Greensboro, 2013. %F A006371 a(2*n) = A006374(n) for all n > 0. - _Robin Visser_, May 29 2025 %e A006371 For n = 6, the a(6) = 2 positive definite reduced binary quadratic forms of discriminant -A014601(6) = -12 are x^2 + 3*y^2 and 2*x^2 + 2*x*y + 2*y^2. For n = 7, the a(7) = 2 positive definite reduced binary quadratic forms of discriminant -A014601(7) = -15 are x^2 + x*y + 4*y^2 and 2*x^2 + x*y + 2*y^2. For n = 8, the a(8) = 2 positive definite reduced binary quadratic forms of discriminant -A014601(8) = -16 are x^2 + 4*y^2 and 2*x^2 + 2*y^2. - _Robin Visser_, May 29 2025 %o A006371 (SageMath) %o A006371 def a(n): %o A006371 D, ans = 2*n+1-(n+1)%2, 0 %o A006371 for b in range(-isqrt(D/3), isqrt(D/3)+1): %o A006371 if ((D+b^2)%4 != 0): continue %o A006371 for a in Integer((D+b^2)/4).divisors(): %o A006371 if ((abs(b)==a) or (a^2==(D+b^2)/4)) and (b < 0): continue %o A006371 if (a >= abs(b)) and (a^2 <= (D+b^2)/4): ans += 1 %o A006371 return ans # _Robin Visser_, May 29 2025 %Y A006371 Cf. A006374, A014601. %K A006371 nonn %O A006371 1,6 %A A006371 _N. J. A. Sloane_ %E A006371 More terms from _Sean A. Irvine_, Mar 19 2017 %E A006371 Name clarified and offset corrected by _Robin Visser_, May 29 2025