Add Galois lab 1
Change-Id: I888fc143dba834e1d4575d4c5c2ed43a4008d5ba
diff --git a/quad9/galois/labs/lab1/utils/.gitignore b/quad9/galois/labs/lab1/utils/.gitignore
new file mode 100644
index 0000000..26ba254
--- /dev/null
+++ b/quad9/galois/labs/lab1/utils/.gitignore
@@ -0,0 +1,2 @@
+cubs
+inverses
diff --git a/quad9/galois/labs/lab1/utils/Makefile b/quad9/galois/labs/lab1/utils/Makefile
new file mode 100644
index 0000000..4f5fdf3
--- /dev/null
+++ b/quad9/galois/labs/lab1/utils/Makefile
@@ -0,0 +1,7 @@
+all: inverses cubs
+
+inverses: inverses.cc
+ g++ inverses.cc -Wall -o inverses
+
+cubs: cubs.cc
+ g++ cubs.cc -Wall -o cubs
diff --git a/quad9/galois/labs/lab1/utils/cubs.cc b/quad9/galois/labs/lab1/utils/cubs.cc
new file mode 100644
index 0000000..ac064f9
--- /dev/null
+++ b/quad9/galois/labs/lab1/utils/cubs.cc
@@ -0,0 +1,9 @@
+#include <iostream>
+
+int main() {
+ int p = 43;
+ for (int i = 0; i < p; ++i) {
+ int a = (i*i*i) % p;
+ std::cout << i << "^3 = " << a << std::endl;
+ }
+}
diff --git a/quad9/galois/labs/lab1/utils/inverses.cc b/quad9/galois/labs/lab1/utils/inverses.cc
new file mode 100644
index 0000000..c54a019
--- /dev/null
+++ b/quad9/galois/labs/lab1/utils/inverses.cc
@@ -0,0 +1,13 @@
+#include <iostream>
+
+int main() {
+ int p = 43;
+ for (int i = 1; i < p; ++i) {
+ for (int j = 1; j < p; ++j) {
+ if ((i*j) % 43 == 1) {
+ std::cout << i << "^{-1} = " << j << std::endl;
+ break;
+ }
+ }
+ }
+}