# Does method exist to solve Diophantine/Algebraic equation with nearest integer variable?

Can anyone kindly tell me if there is a method (other than trial and error) to solve equations of the form below:

$$x^2 + x - 35 - 35[(x^2)/35] = 0$$

where $x$ is an integer and $[y]$ denotes the integer nearest to $y$?

-
Let's see... we have $[b]=\left\lfloor b+\frac12\right\rfloor$, and $p\bmod q=p-q\left\lfloor\frac{p}{q}\right\rfloor$... – J. M. Nov 8 '11 at 17:23
A heuristic is to just remove the floor. Then we are looking at $$x^2+x-35-35\left(\frac{x^2}{35}\right)=x-35.$$ This is zero precisely when $x=35$, and we then expect that the solution of the original will be close to this since it is only off by $35$ whereas $x^2$ has size 1225. Then plugging in 35, we see that $x=35$ is a solution of the original equation. – Eric Naslund Nov 8 '11 at 17:38
Apparently an endash rather than a hyphen was used as a minus sign within TeX. That makes sense considering that an actual typeset minus sign looks much longer than a stubby little hyphen. But when done in TeX, at least with mathJax or whatever it is they use here, it causes the minus sign not to have the usual spacing before it and after it. Strange..... – Michael Hardy Nov 8 '11 at 18:18
Anonymous user who keeps trying to insert "$x$ is an integer": Are you SPSmith? If so, please log in to make your edit. – Henning Makholm Nov 9 '11 at 1:50

This answer assumes that $x$ ranges over at least the positive rationals.

It's not quite clear how far you want to generalize the form of equation you've given. But if we take the "allowed" equations to be all expressions built from one variable and integer constants using any number of addition, multiplication, division and rounding operations, then the general problem is not solvable by algorithmic means.

As J.M. noticed in his comment, we can express the floor and mod functions. And then, $$x\mapsto(\big\lfloor[x]x\big\rfloor \bmod [x], \big\lfloor[x]^2 x\big\rfloor \bmod [x], \big\lfloor[x]^3 x\big\rfloor \bmod [x],\ldots)$$ will allow us to pack any number of non-negative integer variables into a single rational $x$. Thus, we can express any Diophantine problem of the kind Hilbert's 10th problem is about. Since this is known to be undecidable, there cannot be an algorithm for your variant either.

-

This answer assumes that x is an integer.

To avoid the impossibility result mentioned by Makholm, you can write out 35 equations, one for each residue class mod 35. This allows you to replace $\lfloor x^2/35\rfloor$ with $(x^2-k)/35$ for some $0\le k<35.$ Obviously this method does not scale well to large moduli, but it does avoid the Richardson's Theorem-like result that would render the problem undecidable.

-
Are you assuming that $x$ is an integer? That interpretation didn't occur to me, but I suppose it's a possible reading of the question. If so, my construction won't work. – Henning Makholm Nov 9 '11 at 0:49
Yes, I was, given the tags. I don't know if that was actually the intent or not. – Charles Nov 9 '11 at 1:45

A heuristic is to just remove the floor. Then we are looking at

$$x^2+x-35-35\left(\frac{x^2}{35}\right)=x-35.$$ This is zero precisely when $x=35$, and we then expect that the solution of the original will be close to this since it is only off by $35$ whereas $x^2$ has size 1225.

Then plugging in 35, we see that $x=35$ is a solution of the original equation.

-