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/GL2_ZN.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 misc_code/ugly_computations/GL2_ZN.py (limited to 'misc_code/ugly_computations/GL2_ZN.py') 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 @@ +# Prints a list of matrices, the elements of GL_2(Z/nZ) + +def gcd( m, n ): + if n == 0: + return m + return gcd( n, m%n ) + +def print_mat( a, b, c, d ): + print "" + print "|", a, " ", b, "|" + print "|", c, " ", d, "|" + +n = input("Choose n: ") + +count = 0 +for a in range(n): + for b in range(n): + for c in range(n): + for d in range(n): + if gcd( n, abs(a*d-b*c)) == 1: + print_mat(a,b,c,d) + count += 1 + +print "Found", count, "elements" -- cgit v1.3