I need to perform some computations in a modulo ring, like
Mod[Subfactorial[n], m]
Mod[Binomial[n, k], m]
However, this is obviously much too slow for large n and k. Does Mathematica offer a possibility to perform those computations faster by using more efficient algorithms to compute the modulo? For example, there's Andrew Granville's generalization of Lucas' theorem, which would compute the binomial coefficient much faster.
I don't like to implement these by myself, because I want to use Mathematica to cross-check the results of another program of mine.