Esempio n. 1
0
func TestClassNumber1(t *testing.T) {
	classNumber1Nums := []int{-3, -4, -7, -8, -11, -19, -43, -67, -163}
	classNumber1 := mathx.NewIntSet(classNumber1Nums)
	for a := 1; a < 10; a++ {
		for b := -10; b < 10; b++ {
			for c := -10; c < 10; c++ {
				p := poly.NewIntPolynomial64(int64(c), int64(b), int64(a))
				if !p.IsIrreducible() {
					continue
				}
				if Discriminant(p).Sign() > 0 {
					continue
				}
				if !IsFundamentalDiscriminant(Discriminant(p)) {
					continue
				}
				k := MakeNumberField(p)

				if k.ClassNumber() == 1 && !classNumber1.Contains(int(Discriminant(p).Int64())) {
					t.Fail()
				}
			}
		}
	}
}
Esempio n. 2
0
func TestFundamentalDiscriminantsSmall(t *testing.T) {
	fundamentals := []int{1, 5, 8, 12, 13, 17, 21, 24, 28, 29, 33, -3, -4, -7, -8, -11, -15, -19, -20, -23, -24, -31}
	good := mathx.NewIntSet(fundamentals)

	for d := -31; d <= 33; d++ {
		a := IsFundamentalDiscriminant(mathx.NewInt(int64(d)))
		b := good.Contains(d)
		if a != b {
			t.Errorf("Fundamental discriminant failed for ", d)
		}
	}
}