Skip to content

Instantly share code, notes, and snippets.

@brettfreer
Created June 11, 2016 10:30
Show Gist options
  • Save brettfreer/b88b43de091d2cc8ebbe9a3e2f8e5c1e to your computer and use it in GitHub Desktop.
Save brettfreer/b88b43de091d2cc8ebbe9a3e2f8e5c1e to your computer and use it in GitHub Desktop.
Euler's Totient
from fractions import gcd
def eulers_totient(n):
p = 0
for k in range(1, n+1):
if gcd(n,k) == 1:
p += 1
return p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment