%I #21 Jun 11 2026 08:18:18
%S 0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,1,0,0,1,0,1,0,0,0,1,0,1,0,
%T 1,0,0,0,1,1,0,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,0,1,0,1,1,0,0,1,
%U 1,0,1,1,0,1,1,1,0,0,2,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1,0,0,1,0,0,1,0,0,2
%N 2-rank of the class group of the real quadratic field Q(sqrt(k)), k squarefree > 1.
%C Not to be confused with A317992, which gives the 2-ranks of the *form class groups* of real quadratic fields.
%H Jianing Song, <a href="/A391437/b391437.txt">Table of n, a(n) for n = 2..10000</a>
%H Rick L. Shepherd, <a href="https://www.digitalgreensboro.org/record/14435">Binary quadratic forms and genus theory</a>, Master of Arts Thesis, University of North Carolina at Greensboro, 2013.
%F For D = A005117(n), we have a(n) = A317992(n) - 1 if D has a prime factor congruent to 3 modulo 4, A317992(n) otherwise. (See A391439 for a proof). Note that
%F - A317992(n) = omega(A005117(n)) - 1 if A005117(n) == 1 (mod 4);
%F - A317992(n) = omega(4*A005117(n)) - 1 = omega(A005117(n)) - 1 if A005117(n) == 2 (mod 4);
%F - A317992(n) = omega(4*A005117(n)) - 1 = omega(A005117(n)) if A005117(n) == 3 (mod 4).
%o (PARI) r(D) = my(w = omega(D) - 1); my(f = factor(D)[, 1]~); for(i=1, #f, if(f[i]%4==3, return(w-1))); return(w) \\ gives 2-rank of Cl(D) for fundamental D
%o for(D=1, 200, if(D>1 && issquarefree(D), print1(r(D*if(D%4==1, 1, 4)), ", ")))
%Y Cf. A319662 (for imaginary quadratic fields).
%Y For a list of sequences related to the class groups of real quadratic fields, see A390079.
%K nonn
%O 2,79
%A _Jianing Song_, Dec 10 2025