Is there accepted notation for this remainder function

426 Views Asked by At

I have a use for a function that represents the least amount that must be added to an integer $x$ to make it a multiple of $y$.

I.e., if we call that function $\Delta$, then $\Delta(\frac{x}{y}) = y\lceil\frac{x}{y}\rceil-x$

If there isn't an accepted notation, should I use the Delta symbol or an abbreviation, such as "def" for "deficit" or "dif" for "difference"? And is it clearer to express it in the form $\Delta(\frac{x}{y})$ or $\Delta(x,y)$?

For my purpose $x$ and $y$ will always be mutually prime, and positive.

2

There are 2 best solutions below

0
On

When performing division with remainder:

$$n = dq+r$$

where $0\le r <d$ and $r$ is sometimes denoted $n \bmod d$, so

$$n = d\left\lfloor\frac nd\right\rfloor + (n\bmod d)$$

Consider dividing $-x$ by $y$ with remainder,

$$\begin{align*} -x &= y\left\lfloor \frac{-x}{y}\right\rfloor + (-x \bmod y)\\ &= -y\left\lceil\frac xy\right\rceil + (-x\bmod y)\\ y\left\lceil\frac xy\right\rceil - x &= (-x) \bmod y\\ \Delta &= (-x) \bmod y \end{align*}$$


An alternative view, $\Delta$ is a number that satisfy both $0\le \Delta < y$ and

$$\begin{align*} x + \Delta &= ky\\ x + \Delta &\equiv 0 \pmod y\\ \Delta &\equiv -x \pmod y \end{align*}$$

Then $\Delta$ is just $(-x)\bmod y$.

2
On

@JoeSlater In terms of your original question. After the above discussion in the comments, I would recommend, as a notation $b_y(x)$ to represent the "bump of $x$ you need to make it a multiple of $y$." As @peterwhy has shown in his answer above, this quantity is given by the expression:

$$b_y(x)=(-x) \bmod y$$

for all positive integers $x$ and $y$.

(So, if you don't mind writing a little more, you could just write this expression every time you need to refer to this quantity.)