From 5ea79c7ae0d44686f1df05c4a016652afbe58968 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 14 Jun 2026 09:58:21 +0200 Subject: Initial commit --- misc_code/ugly_computations/quadratic_class_number.sage | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 misc_code/ugly_computations/quadratic_class_number.sage (limited to 'misc_code/ugly_computations/quadratic_class_number.sage') diff --git a/misc_code/ugly_computations/quadratic_class_number.sage b/misc_code/ugly_computations/quadratic_class_number.sage new file mode 100755 index 0000000..a26dc50 --- /dev/null +++ b/misc_code/ugly_computations/quadratic_class_number.sage @@ -0,0 +1,12 @@ +# Determines the proportion of real quadratic fields with odd class number. +def f(B): + sqf = [ b for b in range(2,B) if b%4==1 and is_squarefree(b) ] + total_odd = 0 + + R. = PolynomialRing(QQ) + for a in sqf: + if NumberField( x^2 - a, 'c' ).class_number() % 2 == 1: + total_odd += 1 + + print "=1 mod 4 squarefree integers up to", B, ": ", len(sqf) + print "With odd class number:", total_odd -- cgit v1.3