Skip to content

Commit

Permalink
tried problem 500 again
Browse files Browse the repository at this point in the history
  • Loading branch information
timostrating committed Sep 15, 2019
1 parent 9439d09 commit 764e3cc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions python/Problem500.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

maxi = 1000

# https://en.wikipedia.org/wiki/Euler%27s_totient_function
import fractions

def phi(n):
amount = 0
for k in range(1, n + 1):
if fractions.gcd(n, k) == 1:
amount += 1
return amount

print(phi(123))


def devisors(n):
divs = 2
for i in range(2, int(math.sqrt(n)) +1):
Expand Down

0 comments on commit 764e3cc

Please sign in to comment.