Fix code style
This commit is contained in:
parent
f827fd5dd6
commit
cc90c8aa0c
@ -71,8 +71,7 @@ def lcmm(values, n):
|
||||
return lcm(value, lcmm(values[1:], n-1))
|
||||
|
||||
|
||||
# Function implementing the Sieve or Eratosthenes to generate
|
||||
# primes up to a certain number.
|
||||
# Function implementing the Sieve or Eratosthenes to generate primes up to a certain number.
|
||||
def sieve(n):
|
||||
primes = [1] * n
|
||||
|
||||
@ -148,8 +147,7 @@ def sum_of_divisors(n):
|
||||
for i in range(2, limit):
|
||||
if n % i == 0:
|
||||
sum_ = sum_ + i
|
||||
# If n is a perfect square, i=limit is a divisor and
|
||||
# has to be counted only once.
|
||||
# If n is a perfect square, i=limit is a divisor and has to be counted only once.
|
||||
if n != i * i:
|
||||
sum_ = sum_ + n // i
|
||||
|
||||
@ -369,8 +367,7 @@ def phi(n, primes):
|
||||
if n % 2 != 0:
|
||||
break
|
||||
|
||||
# If 3 is a factor of n, multiply the current ph by 1-1/3,
|
||||
# then divide all factors 3.
|
||||
# If 3 is a factor of n, multiply the current ph by 1-1/3, then divide all factors 3.
|
||||
if n % 3 == 0:
|
||||
ph = ph * (1 - 1 / 3)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user