Added: my indefinite forms are reduced in the sense of Gauss and Lagrange. That is, $\langle a, b, c \rangle$ means the form $f(x,y) = a x^2 + b xy + c y^2$ with discriminant $\Delta = b^2 - 4ac.$ Primitive means $\gcd(a,b,c)=1$ while reduced means
$$ ac < 0 \; , \; \; and \; \; \; \; b > |a+c|. $$
There is a proof that this is equivalent to the original "reduced" criteria in a book of Franz Lemmermeyer. I found it by repreated fiddling with the Conway topograph and the Gauss-Lagrange method of neighboring forms.
Here are some examples. Here the ideal class number is halfmy form class number. Simply put, my $\langle 1, 13, -9 \rangle$ and $\langle -1, 13, 9 \rangle$ are mapped to the same ideal. This is all in Buell and other books. Now, consider the (positive) primes represented by $\langle 3, 13, -3 \rangle.$ Evident is $3,$
which is a nonresidue mod 5 and mod 41 because $5,41 \equiv 3 \pmod 3$
$$ \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc $$
205 factored 5 * 41
1. 1 13 -9 cycle length 4
2. -1 13 9 cycle length 4
3. 3 13 -3 cycle length 4
4. -3 13 3 cycle length 4
form class number is 4
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
jagy@phobeusjunior:~$ ./Conway_Positive_Primes 3 13 -3 500
3 13 -3 original form
3 13 -3 Lagrange-Gauss reduced
Represented (positive) primes up to 500
3 7 13 17 47 53 67 97 137 157
167 193 227 233 257 263 293 313 317 347
383 397 457 463
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
these are the collection of remainders when dividing by 5
2 3
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
these are the collection of remainders when dividing by 41
3 6 7 11 12 13 14 15 17 19
22 26 28 29 30 34
$$ \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc $$
221 factored 13 * 17
1. 1 13 -13 cycle length 2
2. -1 13 13 cycle length 2
3. 5 11 -5 cycle length 4
4. -5 11 5 cycle length 4
form class number is 4
$$ \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc $$
5945 factored 5 * 29 * 41
1. 1 77 -4 cycle length 10
2. -1 77 4 cycle length 10
3. 2 77 -2 cycle length 14
4. -2 77 2 cycle length 14
5. 7 73 -22 cycle length 20
6. -7 73 22 cycle length 20
7. 11 73 -14 cycle length 20
8. -11 73 14 cycle length 20
form class number is 8
$$ \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc $$
jagy@phobeusjunior:~/Desktop/Cplusplus$ ./indefCycleLeft 1 77 -4
0 form 1 77 -4 epsilon 77 ambiguous
1 form -4 77 1 Epsilon -19 ambiguous opposite
2 form 20 75 -4 Epsilon 3
3 form -49 45 20 Epsilon -1
4 form 16 53 -49 Epsilon 4
5 form -5 75 16 Epsilon -15 ambiguous
6 form 16 75 -5 Epsilon 4 ambiguous
7 form -49 53 16 Epsilon -1
8 form 20 45 -49 Epsilon 3
9 form -4 75 20 Epsilon -19
10 form 1 77 -4
form 1 x^2 + 77 x y -4 y^2
minimum was 1rep x = 1 y = 0 disc 5945 dSqrt 77
Automorph, written on right of Gram matrix:
-159166445 8262816
2065704 -107237
for Pari/gp: rt = [ -159166445 , 2065704 ; 8262816 , -107237 ] ; h = [ 2 , 77 ; 77 , -8 ] ; r = [ -159166445 , 8262816 ; 2065704 , -107237 ] ;
opposite Pari/gp: rt = [ 77 , -1 ; 1 , 0 ] ; h = [ 2 , 77 ; 77 , -8 ] ; r = [ 77 , 1 ; -1 , 0 ] ;
=========================================
$$ \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc $$