Skip to content

Instantly share code, notes, and snippets.

@estensen
Created April 13, 2018 17:24
Show Gist options
  • Select an option

  • Save estensen/bd75fd6483785bd94f1045faed28490f to your computer and use it in GitHub Desktop.

Select an option

Save estensen/bd75fd6483785bd94f1045faed28490f to your computer and use it in GitHub Desktop.
Euler's totient function
import math
f = lambda n:sum(math.gcd(n,x)<2for x in range(n))
print(f(500)) # 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment