As is well known, division of integers with remainder can be defined in different ways. The definition in Wolfram and the definition in theoretical mathematics are different. How to express traditional division with remainder in Wolfram? Here is a variant solution:
In the traditional definition of dividing integers with a remainder, the remainder cannot be negative. This is neither right nor wrong. It is a different definition.
Did you actually test it? If you provide an example where the implementation I suggested differs from the implementation you provided, then I can work on a better implementation.
Okay, I understand that this is just a matter of conventions. Just out of curiosity: Do you have any reference to support that positive remainders is the common and established convention?
Any number theory textbook (not for programmers) defines the traditional division of integers with remainder. For example, Burton, Elementary number theory (2011). This is necessary to determine modulo equivalence. The number of remainders when dividing by n, must be |n|. So it’s strange to me that Wolfram didn’t provide this function.
Well, yeah, you ran the function on symbols which then resolved to the built in QuotientRemainder. Why would you use ReplaceAll like that? But if that’s the way you want to use it, then you can add constraints on the arguments.
Also, I should probably clarify that I’m not saying this implementation is “right” in any sense. Either of your other implementations is just fine as far as I’m concerned. You asked for alternatives, and since QuotientRemainder is already built in and gives you almost everything you want, using it seemed like a reasonable alternative.