aboutsummaryrefslogtreecommitdiff
path: root/misc_code/ugly_computations/GL2_ZN.py
diff options
context:
space:
mode:
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