I'm playing around with implementing the Lucas probable prime test (mainly so I can understand it better), and would love a version of the LinearRecurrence function that used addition modulo n (with n supplied by the user) instead of ordinary addition (which can easily result in overflows).
It wouldn't be all that crazy-hard to implement one, I think, and might even be quite interesting to do, but I thought I'd ask whether anyone already knows of such a thing.
Algebra`MatrixPowerMod[]](https://mathematica.stackexchange.com/a/123241), which might help in your implementation. – J. M.'s missing motivation Sep 10 '20 at 11:17