talc/examples/totient.talc

10 lines
161 B
Text
Executable file

#!/usr/bin/env talc
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