aboutsummaryrefslogtreecommitdiff
path: root/misc_code/ugly_computations/quadratic_class_number.sage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xmisc_code/ugly_computations/quadratic_class_number.sage12
1 files changed, 12 insertions, 0 deletions
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 @@
1# Determines the proportion of real quadratic fields with odd class number.
2def f(B):
3 sqf = [ b for b in range(2,B) if b%4==1 and is_squarefree(b) ]
4 total_odd = 0
5
6 R.<x> = PolynomialRing(QQ)
7 for a in sqf:
8 if NumberField( x^2 - a, 'c' ).class_number() % 2 == 1:
9 total_odd += 1
10
11 print "=1 mod 4 squarefree integers up to", B, ": ", len(sqf)
12 print "With odd class number:", total_odd

Generated with cgit - Back to sebastiano.tronto.net