totient = \n -> do count(factors(n)) | pairs | map(\v -> do (v!0)^(v!1) - (v!0)^(v!1 - 1) end) | prod end println(totient(6615)) -- 3024