diff options
-rw-r--r-- | H34.hs | 3 | ||||
-rw-r--r-- | H36.hs | 5 | ||||
-rw-r--r-- | H37.hs | 5 | ||||
-rw-r--r-- | H38.hs | 4 |
4 files changed, 16 insertions, 1 deletions
@@ -1,3 +1,4 @@ -- http://en.wikipedia.org/wiki/Euler%27s_totient_function -totient :: Integral a => a -> Bool + +totient :: (Integral a) => a -> Int totient x = length $ filter ((==1).(gcd x)) [1..x] @@ -1,3 +1,8 @@ +module H36 +( + primeFactorsMult +) where + import H35 import H10 @@ -0,0 +1,5 @@ +import H36 + +toitient :: Integer -> Integer +toitient n = foldr (\(y,_) x -> x * (y-1) `div` y) n (primeFactorsMult n) + @@ -0,0 +1,4 @@ +-- Measure performance with GHC +-- https://wiki.haskell.org/Performance/GHC#Measuring_performance + +-- In ghci :set +s will output the time consumption for every command |