Skip to content

Instantly share code, notes, and snippets.

@dbfin
Last active August 29, 2015 13:55
Show Gist options
  • Save dbfin/8725023 to your computer and use it in GitHub Desktop.
Save dbfin/8725023 to your computer and use it in GitHub Desktop.
-- Euler's totient function
phi :: Int -> Int
phi n = product $ map (\(p,pw) -> (p - 1) * p^(pw - 1)) $ factor n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment