diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-06-14 09:58:21 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-06-14 09:58:21 +0200 |
| commit | 5ea79c7ae0d44686f1df05c4a016652afbe58968 (patch) | |
| tree | 05f6a052373f5fe0942777a48303b2f8b884cbe1 /misc_code/ugly_computations/GL2_ZN.py | |
| download | kummer-notes-code-5ea79c7ae0d44686f1df05c4a016652afbe58968.tar.gz kummer-notes-code-5ea79c7ae0d44686f1df05c4a016652afbe58968.zip | |
Initial commit
Diffstat (limited to '')
| -rwxr-xr-x | misc_code/ugly_computations/GL2_ZN.py | 24 |
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 | |||
| 3 | def gcd( m, n ): | ||
| 4 | if n == 0: | ||
| 5 | return m | ||
| 6 | return gcd( n, m%n ) | ||
| 7 | |||
| 8 | def print_mat( a, b, c, d ): | ||
| 9 | print "" | ||
| 10 | print "|", a, " ", b, "|" | ||
| 11 | print "|", c, " ", d, "|" | ||
| 12 | |||
| 13 | n = input("Choose n: ") | ||
| 14 | |||
| 15 | count = 0 | ||
| 16 | for 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 | |||
| 24 | print "Found", count, "elements" | ||
