Why when $t\equiv n\pmod s$, $n$ is also $t - s\lfloor \frac{t}{s}\rfloor$?

30 Views Asked by At

I'd like to know why when $t\equiv n\pmod s$, $n$ is also $t - s\lfloor \frac{t}{s}\rfloor$?

Here, $n\in[0;s[$

I can't find a way to prove $n$.

Thank you for your help!

2

There are 2 best solutions below

0
On BEST ANSWER

$n$ is the remainder when $t$ is divided by $s$, which you can write as $t = n+sq$.

Since the quotient, $q$, is the integer part of the result of the division, $q = \left\lfloor\frac{t}{s}\right\rfloor$.

Substitute that in and do a basic transposition, and you get $n = t-s\left\lfloor\frac{t}{s}\right\rfloor$.

0
On

With mwt's help, I just figured it out.

Okay so let's express $t$ as $ks+n$ for some $k\in\mathbb Z$

$t-s\lfloor \frac{t}{s} \rfloor = ks+n-s\lfloor \frac{ks+n}{s} \rfloor = n-s\lfloor \frac{n}{s} \rfloor$

However $n \in [0;s[$, so :

$n-s\lfloor \frac{n}{s} \rfloor=n$