Solving $ \left \lfloor \frac{x^2 + \left(n+1\right)x+n}{6x} \right \rfloor - \left \lceil \frac{x^2 + 2x+n}{6x} \right \rceil = \frac{n-1}{6} $

131 Views Asked by At

Given an integer number $n$ and the following equation. How to find $x$? (For example, take $n=55$.) $$ \left \lfloor \frac{x^2 + \left(n+1\right)x+n}{6x} \right \rfloor - \left \lceil \frac{x^2 + 2x+n}{6x} \right \rceil = \frac{n-1}{6} $$

For $n=55$ the solution is $x=5$.

I've been searching the Internet for ways to solve similar problems. But I didn't find anything similar.

PD: I forgot to mention that all the numbers (x and n) are positive integers not divisible by 2 or 3 and the solutions must be the same. The solutions need to be lower or equal the square root of n. I have 3 more equation like this. In total are 4 equations that cover all the posible values for n (not divisible by 2 or 3). I think the solution for the 4 equations involves complex numbers too. I am trying now to solve it with complex numbers. If I can, I will post the solution here.

2

There are 2 best solutions below

2
On

(n-1)/6 is the difference of two integers and therefore an integer, so n =6k+1.

The difference between the arguments for floor() and ceil() is exactly (n-1)/6. But ceil() rounds down, floor() rounds up, so the difference is <= (n-1)/6. It can only be equal if both arguments are integers.

Looking at the argument for ceil(), x/6 + 1/3 + n/6x is an integer, or x + 2 + n/x is multiple of 6. To make it at least an integer, x must divide n. n = 6k+1 is not divisible by 2 or 3, so neither is x; we have n = x * z where x, z modulo 6 are both 1 or both 5.

Now x + 2 + z must be a multiple of 6, and for that x, z modulo 6 need both to be equal to 5.

So we have n = 6k + 1, with a divisor x = 6y + 5. That matches the example n = 55, x = 5. And if (n, x) is solution, then so is (n, n/x).

We find all solutions by picking all pairs (x, n = z * x) where x, z modulo 6 equals 5. Solutions are n = 5 x 5, 11 x 5, 17 x 5, 23 x 5, .. 11 x 11, 17 x 11, 23 x 11 and so on.

Allowing non-integer x: Assume x is not an integer and x <= n/x or x^2 <= n. We still need x + 2 + n/x to be a multiple of 6. If we let 0 < x <= sqrt(n), then x + 2 + n/x varies from the largest reals down to 2 + 2 sqrt(n). For every n there is an infinite number of solutions.

0
On

Since the floor and ceiling functions have their image in the integers, and integers are closed under addition, then $\frac{n-1}{6}\in \mathbb{Z}$ which in turn implies that $ n = 6k +1$ for some $k \in \mathbb{Z}$. Defining $m = \frac{x^2+2x+n}{6x}$ we have that the original equation is simply $$ \left\lfloor m+k\right\rfloor - \left\lceil m\right\rceil = k $$ Now, since $k$ is an integer, then $\forall a \in \mathbb{R}, \lfloor a+k\rfloor = \lfloor a\rfloor +k$. Thus we're looking for when $$ \left\lfloor m\right\rfloor = \left\lceil m \right\rceil $$ The floor and ceiling of a number coincide only when the input is an integer itself. Hence we require $m \in \mathbb{Z}$, which leads to $$ \boxed{x_{\mathrm{real}} = 3m-1 \pm\sqrt{(3m-1)^2-n}, \qquad m\in \mathbb{Z};\,(3m-1)^2 \ge n}\tag{1} $$ where the last condition is set to guarantee that $x$ is real.

If we're interested in integer solutions, to cancel out the square root in $(1)$ we need to analyze when $(3m-1)^2 -n = j^2$ for some integer $j$. Solving for $n$ we get $$ n = (3m-1+j)(3m-1-j) $$ so $d= 3m-1+j$ is one divisor of $n$ and $\frac{n}{d} = 3m-1-j$ is another divisor, such that $d \ge \frac{n}{d}$. This system of equations has solution $j = \frac{d - \frac{n}{d}}{2}$ and $m = \frac{d+\frac{n}{d}+2}{6}$. Since $n$ is odd, then its divisors are also odd, $j$ is always an integer for any $d\vert n$. For $m = \frac{d^2+n+2d}{6d}$ to be integer, we need $d^2+2d \equiv-n \pmod{6}$. But since $-n = 6(-k) -1$, this implies that $-n\equiv 5 \pmod{6}$ and thus $$ d^2+2d\equiv 5 \pmod{6} $$ Solving the previous congruence gives $d\equiv 5 \pmod{6}$.Thus, the integer solutions are $$ x_{\mathrm{integer}} = \frac{1}{2}\left(d+ \frac{n}{d} \pm\left(d-\frac{n}{d}\right)\right), \qquad d\vert n;\ d\equiv 5 \,(\mathrm{mod}\,6); d\le \frac{n}{d} $$ but simplifying the above tells us that the two solutions are $x_{\mathrm{integer}} = d, \frac{n}{d}$ which are the pair of divisors themselves!

The final observation is that since $\gcd(6,5) =1$ then there is a unique multiplicative inverse of $5$ mod $6$, which turns out to also be $5$ since $5(5) = 6(4)+1$. Since we also know that $n = 6k+1\equiv 1 \pmod{6}$, then if $\color{blue}{d} \equiv \color{blue}{5} \pmod{6}$ this implies $$ 1 \equiv n = \frac{n}{d}(\color{blue}{d})\equiv\frac{n}{d}(\color{blue}{5})\pmod{6}\quad \implies \frac{n}{d}\equiv 5 \pmod{6} $$ Thus, whenever $d\vert n$ is congruent to $5$ mod $6$, then its complementary divisor $\frac{n}{d}$ is also congruent to $5$ mod $6$. This allows us to simplify the search to only the divisors congruent to $5$ mod $6$, resulting in the final formula $$ \boxed{x_{\mathrm{integer}} = d, \quad d\vert n;\ d\equiv 5 \,(\mathrm{mod}\,6)}\tag{2} $$


For the $n=55$ example, solving $(3m-1)^2 \ge 55$ gives $m \ge 2.8$ or $m \le -2.1$ (aproximately), so $m \in \mathbb{Z} \setminus\left\{-2,-1,0,1,2\right\}$ gives a valid solution for $x$ in equation $(1)$.

For the integer solutions, we notice that the divisors of $55$ are $\{\pm 1,\pm 5,\pm 11,\pm 55\}$. Out of these, only $5,11, -1, -55$ are congruent to $5\pmod{6}$. Thus, using $(2)$, the full list of integer solutions are $$ x = 5,11,-1, -55 $$