aboutsummaryrefslogtreecommitdiff
path: root/misc_code/ugly_computations/GL2_ZN.py
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/GL2_ZN.py
downloadkummer-notes-code-5ea79c7ae0d44686f1df05c4a016652afbe58968.tar.gz
kummer-notes-code-5ea79c7ae0d44686f1df05c4a016652afbe58968.zip
Initial commit
Diffstat (limited to '')
-rwxr-xr-xmisc_code/ugly_computations/GL2_ZN.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/misc_code/ugly_computations/GL2_ZN.py b/misc_code/ugly_computations/GL2_ZN.py
new file mode 100755
index 0000000..c706703
--- /dev/null
+++ b/misc_code/ugly_computations/GL2_ZN.py
@@ -0,0 +1,24 @@
1# Prints a list of matrices, the elements of GL_2(Z/nZ)
2
3def gcd( m, n ):
4 if n == 0:
5 return m
6 return gcd( n, m%n )
7
8def print_mat( a, b, c, d ):
9 print ""
10 print "|", a, " ", b, "|"
11 print "|", c, " ", d, "|"
12
13n = input("Choose n: ")
14
15count = 0
16for a in range(n):
17 for b in range(n):
18 for c in range(n):
19 for d in range(n):
20 if gcd( n, abs(a*d-b*c)) == 1:
21 print_mat(a,b,c,d)
22 count += 1
23
24print "Found", count, "elements"

Generated with cgit - Back to sebastiano.tronto.net