Let $p=4295098403$ (tested prime), let $z=65537$ (prime). The following equality:
$$(kp - kp\bmod z) \equiv k(p-p\bmod z)\bmod p$$
is true for values of $k<1928$, but false for $k \geq 1928$. This may be a silly question, but what in the world is going on here (besides my lack of math comprehension)?
UPDATE: this can be reduced to $\left\lfloor\frac{kp}{z}\right\rfloor \equiv k\left\lfloor\frac{p}{z}\right\rfloor\ \text{mod}\ p$ only for smaller values of $k$.
Try it in Python:[k for k in range(z) if (k*p)/z == k*(p/z)]
Generally speaking, what is the proper way to distribute the k value to the inner mod? Thanks!