Let $a,x,y \in \mathbb{N}$ with $ax \ge y$, and let % be the remainder from integer divison, always positive. Define $$A:=y \text{%} a + (a x -y) \text{%} a.$$Then using the distributive property for %, it is true that $A$%$a=0$. From this we infer that there exists an $n : \mathbb{N}^3 \rightarrow \{0,1\}$ such that $$A = a n(x, y).$$
It is clear that $n(x, y) = \frac{y \text{%} a + (a x -y) \text{%}a}{a}.$ How can I simplify the form of $n$ to express it without the division by $a$?