From 0947fadbdfb96f36862b7c123e27c402beb4cd4c Mon Sep 17 00:00:00 2001 From: Szymon Wojciechowski Date: Thu, 28 Jun 2018 09:02:51 +0000 Subject: [PATCH] Delete 'Ring.py' --- Ring.py | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 Ring.py diff --git a/Ring.py b/Ring.py deleted file mode 100644 index 88345d4..0000000 --- a/Ring.py +++ /dev/null @@ -1,48 +0,0 @@ -from fractions import gcd - -class Modulo: - - def __init__(self, n): - self.n = int(n) - self.modulo_set = list(range(self.n)) - self.answer = [] - - def get_inverse_elements(self): - self.inverse_elements = [] - for i in self.modulo_set: - if gcd(i, self.n) == 1: - self.inverse_elements.append(i) - self.answer.append(self.inverse_elements) - - def get_zero_divisors(self): - self.zero_divisors = [] - for i in self.modulo_set: - for j in self.modulo_set: - if (i * j) % self.n == 0 and i != 0 and j != 0: - self.zero_divisors.append(i) - self.answer.append(list(set(self.zero_divisors))) - - def get_nilpotent_elements(self): - self.nilpotent_elements = [] - for i in self.modulo_set: - for j in range(1, len(self.inverse_elements) + 1): - if (i**j) % self.n == 0 and i != 0: - self.nilpotent_elements.append(i) - self.answer.append(list(set(self.nilpotent_elements))) - - def get_idempotent_elements(self): - self.idempotent_elements = [] - for i in self.modulo_set: - if (i*i) % self.n == i: - self.idempotent_elements.append(i) - self.answer.append(self.idempotent_elements) - - def get_all(self): - self.get_inverse_elements() - self.get_zero_divisors() - self.get_nilpotent_elements() - self.get_idempotent_elements() - return self.answer - -s = Modulo(input("Enter n: ")) -print(s.get_all())