Ad
Code
Diff
  • from math import gcd
    
    def totient(a):
        """python 3.6.0"""
        return len([b for b in range(a) if (gcd(a, b) == 1)])
    • from math import gcd
    • def totient(a):
    • out = 0
    • for b in range(a):
    • if(gcd(a, b) == 1):
    • out += 1
    • return out
    • def gcd(a, b):
    • while b != 0:
    • (a, b) = (b, a % b)
    • return a
    • """python 3.6.0"""
    • return len([b for b in range(a) if (gcd(a, b) == 1)])