Solution(s) for the largest remainder?

615 Views Asked by At

I have reached the following argument of the maximum problem:

$$ \hat{x} = \mathop{\arg\,\max}\limits_x \, \rm (n\ mod\ x), \quad \text{for $1 \le x \le n$, where $x,n \in \mathbb{N}^{+}$.}$$

My question is in regards the possible solution(s):

  • Is there only one solution for all integers $n$?
  • Does a general closed form expression for $\hat{x}$ exist (i.e., the largest remainder)?
  • What can be said about $\hat{x}$ in general? Is $(\hat{x} - \rm (n\ mod\ \hat{x})) > 0$ generally (and trivially) true for all $n$?

My research efforts got me reading about the Largest Remainder Methods. The problem I am facing, is to find $k \le n$ integers $n_1, n_2, \dots, n_k$, such that these are of similar size and sum to $n$. In general, when $\rm (n\ mod\ k) \neq 0$, I have the problem of distributing the remainder onto the $k$ integers - or live with a weird $n_{k+1}$.

1

There are 1 best solutions below

2
On BEST ANSWER

If $x > \frac{n}{2}$, the remainder of $n$ modulo $x$ is $n-x$, and that evidently attains its maximum if $x$ is chosen as small as possible subject to the condition $x > \frac{n}{2}$. That gives us $x = \left\lfloor \frac{n}{2}\right\rfloor+1$ with the remainder $n - \left\lfloor \frac{n}{2}\right\rfloor - 1 = \left\lceil \frac{n}{2}\right\rceil - 1 = \left\lfloor \frac{n-1}{2}\right\rfloor$.

If $x \leqslant \frac{n}{2}$, since the remainder modulo $x$ is strictly smaller than $x$, the maximal possible remainder would be $\left\lfloor \frac{n}{2}\right\rfloor - 1 = \left\lfloor \frac{n-2}{2}\right\rfloor$. That bound is strictly smaller than the value $\left\lfloor\frac{n-1}{2}\right\rfloor$ for odd $n$, and for even $n$, only $x = \frac{n}{2}$ makes that bound reachable at all, but then $n \equiv 0 \pmod{x}$, so we have the unique maximal remainder for

$$\hat{x} = \left\lfloor \frac{n}{2}\right\rfloor + 1$$

with the value $\left\lfloor \frac{n-1}{2}\right\rfloor$.