1

I have two natural numbers $2\le b\lt a$. I want to know the least natural number $x_1$ such that $\frac{xa}{b}$ gives a remainder of $1$, and the least natural number $x_2$ such that the remainder is $b-1$ (I'm looking for a formula, not an algorithmic procedure).

In other words, that

$$ \frac{x_1a}{b}-\left\lfloor\frac{x_1a}{b}\right\rfloor=\frac{1}{b}\\ \frac{x_2a}{b}-\left\lfloor\frac{x_2a}{b}\right\rfloor=\frac{b-1}{b}\\ $$

Assume that $a$ is not divisible by $b$, so that both $x$ exist.

Under that assumption, I know that $x_1,x_2\in [1, \ldots, b - 1]$ because all possible remainders from $0$ up to $b-1$ happens exactly once when the multipliers goes from $1$ to $b$.

For example, for $\frac{19}{7}$ iterating a multiplier $x$ over $1, 2, \ldots, 7$ gives the following list of remainders:

$$ 5 \quad 3\quad 1\quad 6\quad 4\quad2\quad 0 $$

where the position ocuppied by the remainder $1$ ($x_1=3$ in this case), is the "step size" of the remainder list, because it is the number of forward positions, moving in a circular fashion, to reach the next remainder ($2$ appears three positions later, 3, other three positions later, 4, other three positions later, and so on).

About $x_2$, I know that $x_2=mod(x_1(b-1), b)$, but that's not a very useful expression that I could use comfortably in other equations that I'm working on, so I wonder if there's a way to express $x_2$ that doesn't involve the explicit use of modular arithmetic.

ABu
  • 451
  • 2
  • 9
  • 2
    Seems you're looking for a multiplicative inverse of $a$ modulo $b$ (as $x_1$). Is there any particular reason you aren't comfortable with modular arithmetics? – Alexey Burdin Jan 28 '21 at 02:46
  • "I'm looking for a formula, not an algorithmic procedure" Why should there be one. – fleablood Jan 28 '21 at 02:54
  • " but that's not a very useful expression that I could use comfortably in other equations that I'm working on" Why not? – fleablood Jan 28 '21 at 02:56
  • @AlexeyBurdin Because I'm not proficient with it, and I'm working with some inequations involving a set of floor functions and fractional parts trying to find/proof properties of a specific problem of mine. Modular arithmetic will just make the problem a bit more harder for me, so I'm trying to avoid it if I can. – ABu Jan 28 '21 at 03:07
  • @fleablood Why should I know? That's why I ask :) – ABu Jan 28 '21 at 03:07
  • 1
    modular arithmetic makes everything easier and avoiding modular arithmetic makes everything harder. And you can learn everything you need to know about modular arithmetic in two sentences: If you divide an integer by an integer $n$ there will be a remainder. You can do all arithmetic by only paying attention to the remainders and ignoring everything else. Now you know everything you need to know and everything will be easier. (I serious. It will.) – fleablood Jan 28 '21 at 07:08

0 Answers0