module Numeric.NumberTheory ( totient
, tau
, totientSum
) where
import Foreign.C
foreign import ccall unsafe totient_ats :: CInt -> CInt
foreign import ccall unsafe count_divisors_ats :: CInt -> CInt
foreign import ccall unsafe totient_sum_ats :: CInt -> CInt
conjugate :: (CInt -> CInt) -> Int -> Int
conjugate f = fromIntegral . f . fromIntegral
tau :: Int -> Int
tau = conjugate count_divisors_ats
totient :: Int -> Int
totient = conjugate totient_ats
totientSum :: Int -> Int
totientSum = conjugate totient_sum_ats