arithmoi
arithmoi copied to clipboard
Type-level Totient function
I've been thinking recently about implementing something along these lines:
type family Totient (m :: Nat) :: Nat
totientNat :: Integral a => SFactors a m -> (() :- KnownNat (Totient m))
power :: Mod m -> Mod (Totient m) -> Mod m
discreteLog :: CyclicGroup Integer m -> PritimiveRoot m -> MultMod m -> Mod (Totient m)