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.
(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.