Anonymous user
Multiplicative order: Difference between revisions
→{{header|Python}}: clarify and simplify code
(→{{header|Python}}: clarify and simplify code) |
|||
Line 120:
def isPrime(p):
return (p > 1) and all(f == p for f,e in factored(p)
primeList = [2,3,5,7]
Line 129 ⟶ 127:
yield p
while 1:
p += 2
while not isPrime(p):
p += 2
primeList.append(p)
yield p
Line 138 ⟶ 136:
for p in primes():
j = 0
while a%p == 0:
a /= p
j += 1
if j > 0:
yield (p,j)
if a < p*p: break
Line 148 ⟶ 146:
def multOrdr1(a,(
m =
t =
qs = [1,]
for f in factored(t):
|