Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
84daabe853 |
60
Proj1.py
Normal file
60
Proj1.py
Normal file
@ -0,0 +1,60 @@
|
||||
from math import *
|
||||
|
||||
def explore():
|
||||
n=input("podaj n ")
|
||||
n=int(n)
|
||||
resztyn = []
|
||||
for x in range(0,n):
|
||||
resztyn.append(x)
|
||||
|
||||
print "Elementy odwracalne: "
|
||||
for a in range(0,len(resztyn)):
|
||||
for b in range(0,len(resztyn)):
|
||||
c=((a*b)%n)
|
||||
if c==1 :
|
||||
print a
|
||||
else:
|
||||
continue
|
||||
|
||||
print "Dzielniki zera: "
|
||||
for a in range(0,len(resztyn)):
|
||||
for b in range(1,len(resztyn)):
|
||||
c=((a*b)%n)
|
||||
if c==0 :
|
||||
print a
|
||||
break
|
||||
else:
|
||||
continue
|
||||
|
||||
print "Elementy idenpotentne:"
|
||||
for a in range(0,len(resztyn)):
|
||||
c=((a*a)%n)
|
||||
if c==a:
|
||||
print a
|
||||
else:
|
||||
continue
|
||||
|
||||
print "Elementy nilpotentne:"
|
||||
print "0"
|
||||
for a in range(1,len(resztyn)):
|
||||
for p in range(1,1000):
|
||||
c=((a**p)%n)
|
||||
if c==1:
|
||||
break
|
||||
|
||||
if c==0:
|
||||
print a
|
||||
break
|
||||
else:
|
||||
continue
|
||||
|
||||
|
||||
print '\n'
|
||||
|
||||
|
||||
|
||||
while 1:
|
||||
explore()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user