Finding $\left\lfloor\frac{a}{2} \right\rfloor \mod p$ knowing $a \mod p$ and $a \mod 2$?

40 Views Asked by At

Knowing $$(a \mod p)\ \text{and}\ (a \mod 2)$$ can we definitely say what is $$\left\lfloor \frac{a}{2}\right\rfloor \mod p$$ where $p$ is a prime. If not possible what else is required to do the same?

1

There are 1 best solutions below

3
On BEST ANSWER

By knowing $a\!\!\mod p$ and $a\!\!\mod 2$, we know $a\!\!\mod 2p$ by Chinese Remainder Theorem.

As such, let $a=2pq+r$, where $q$ and $r$ are the quotient and remainder.

$$\left\lfloor\frac{a}{2}\right\rfloor=\left\lfloor\frac{2pq+r}{2}\right\rfloor\\=\left\lfloor\frac{2pq+r}{2}\right\rfloor\\=pq+\left\lfloor\frac{r}{2}\right\rfloor\equiv\left\lfloor\frac{r}{2}\right\rfloor\mod p$$