For odd positive integer m=c2-r, define the characteristic polynomial f(x)=x2+2cx+r. We are looking for the least nonnegative integer x for which f(x) is a perfect square.
Completing the square of the polynomial may give us a way to find values of x given f(x). I decided to try to determine when f(x) = 0, 1, 4, 9, and so on, so that I would have a series I could examine to try to predict when x would be an integer.
f(x)=(c+x)2-m, it turns out. When f(x)=a2 for some a (not necessarily integer, x=(m+a2)1/2-c. With c an integer, we can discount it, and look at the series of the square roots of m+a2 to watch how the numbers behave. x will not be an integer until m+a2 is a perfect square.
For a small scale example, take m=689. c=27. 689+02, the portion of the expression of x under the radical for f(x)=0, lies between 262 and 272. x stays between the squares of 26 and 27 for a while as a increases.
0: 689+0 = 689 = 262 + 13 = 272 - 40. 1: 689+1 = 690 = 262 + 14 = 272 - 39. 2: 689+4 = 693 = 262 + 17 = 272 - 36. 3: 689+9 = 698 = 262 + 22 = 272 - 31. 4: 689+16 = 705 = 262 + 29 = 272 - 24. 5: 689+25 = 714 = 262 + 38 = 272 - 15. 6: 689+36 = 725 = 262 + 49 = 272 - 4.
This is the last value of f(x)=a2 in the series for which x will be between 26 and 27. If, for a=7, we had hit the boundary value 272 exactly, the progression would have been quadratic and uninterrupted. But now there is the change of “betweenness” to deal with.
This jump in the perfect squares between which a value lies is typical of the jumps encountered in any of the various methods I have explored to find a formula to predict when a value I am trying to track hits the perfect square boundary exactly. I plan to explore it more, and hope I will see what I have not yet seen, in terms of a way to anticipate that value, not only algorithmically, but with a closed formula.
It’s not over yet!