aboutsummaryrefslogtreecommitdiff
path: root/misc_code/ugly_computations/quadratic_class_number.sage
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-06-14 09:58:21 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2026-06-14 09:58:21 +0200
commit5ea79c7ae0d44686f1df05c4a016652afbe58968 (patch)
tree05f6a052373f5fe0942777a48303b2f8b884cbe1 /misc_code/ugly_computations/quadratic_class_number.sage
downloadkummer-notes-code-5ea79c7ae0d44686f1df05c4a016652afbe58968.tar.gz
kummer-notes-code-5ea79c7ae0d44686f1df05c4a016652afbe58968.zip
Initial commit
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