EDIT: What I wrote was more about the general case. In this specific case, the largest number we get after modulo would be 14, and 14^4 is only 38,416 so it does actually stay small for this specific instance of the problem.
> If the commutative property holds for a pair of elements under a certain binary operation then the two elements are said to commute under that operation.
https://en.wikipedia.org/wiki/Modular_arithmetic#Properties
It should be easy to see that
n ≡ (n % 15) (mod 15)
which, applying compatibility of exp, then gives us n^4 ≡ (n % 15)^4 (mod 15)
which can be rewritten in Python's notation as n**4 % 15 == (n % 15) ** 4 % 15You really want to say that mod15(pow4(x)) == mod15(pow4(mod15(x))).
Example:
(3 ** 4) % 15 = 81 % 15 = 6.
But,
(3 % 15) ** 4 = 3 ** 4 = 81.
(That said, the two functions do commute when you restrict your domain and range to Z/15.)
edit: also, I wouldn't consider mod15 to be an injection, as it's, um, not injective (it maps multiple inputs to the same output).
It's not actually the same pow4 on the LHS and RHS (the LHS is in Z, the RHS in Z/15), but I think "commutative" still fits.
> as it's, um, not injective
Er, surjection :)
Then the desired statement showing commutativity is
pow4'(mod15(x)) = pow4'(x) = mod15(pow4'(x))
where that last equality is trivial because mod15 o mod15 = mod15
so mod15 o pow4' = mod15 o mod15 o pow4 = mod15 o pow4 = pow4'
per associativity of function compositionSo the terms are correct.
As far as programmers, modulus is an operator, complete with operator overloading in many languages and satisfying operator precedence. So operator is the correct word there also.
Here's the idea from math https://mathoverflow.net/questions/20968/rules-for-operator-...