zad 4 #32

Closed
s426285 wants to merge 9 commits from s426285/DALGLI0:zad_4 into master
Showing only changes of commit b34b9a42fb - Show all commits

4
hw4.py
View File

@ -49,7 +49,7 @@ class QuotientRing():
def idempotent(self): def idempotent(self):
idems = [] idems = []
for rem in self.remainders: for rem in self.remainders:
if (rem * rem / self.f) == (rem / self.f): if (rem * rem % self.f) == (rem % self.f):
idems.append(rem) idems.append(rem)
try: try:
if idems[0].poly == []: #implementacja wielomianow ucina zera if idems[0].poly == []: #implementacja wielomianow ucina zera
@ -63,7 +63,7 @@ class QuotientRing():
phi = len([ i for i in range(1, self.m) if gcd(i, self.m) == 1 ]) phi = len([ i for i in range(1, self.m) if gcd(i, self.m) == 1 ])
for zero_div in self.zero_divisors: for zero_div in self.zero_divisors:
for i in range(self.m): for i in range(self.m):
if len((zero_div ** i / self.f).poly) == 0: if len((zero_div ** i % self.f).poly) == 0:
nils.append(zero_div) nils.append(zero_div)
break break
return nils return nils