When is $K = an^2 + bn + c$ a square number?

118 Views Asked by At

Suppose I had the equation: $K = an^2 + bn + c$ where:

  • $n$ is a positive unknown integer.
  • $a,b,c$ are positive known integers.

Problem: What values of $n$ make $K$ a square number?

(1a) Is there any general method to solving this, or can it only begin to be solved when I select $a,b$ and $c$ (assuming it has solutions).

(1b) What methods should I use to solve this?

(2) Does this problem change in difficulty if I make $a$ and $b$ very large?

3

There are 3 best solutions below

2
On

I would treat the question as when $$n^2 + an + b = (n + c)^2.$$

This kind of problem can be solved by opening brackets and equating the coefficients, i.e.

$$n^2 + an + b = n^2 + 2cn + c^2,$$

which boils down to

$$a = 2c$$

and

$$b = c^2.$$

So, we have that $c = \frac{a}{2}$, when

$$b = \frac{a^2}{4}.$$

0
On

EDIT: Sadly the assumption that the roots would be rational was, in fact, incorrect and therefore useless. Since the rest of what's here followed from that, please feel free to ignore this. I'm leaving it here for posterity only.

Counterexample to the assumption: $K = 2x^2+3x+5$. The quadratic has roots of $\frac14(3 \pm i \sqrt{31})$, yet there is an integer solution with $n = 19, K = 28^2$. The quadratic $2x^2+3x+(5-K)$ has real roots for $K \ge 4$.



Note: This isn't really an answer so much as a bunch of comments that went through my brain. Perhaps looking at some of the constraints will be helpful to you.

I'll assume the quadratic has rational roots $\frac wx$ and $\frac yz$, which we can find readily; I'm pretty sure that otherwise there are no solutions with $n,K\in\mathbb{N}$. Also, $a$ is rational, so let's set $a=\frac uv$, and set $K = k^2$. Assume each of the pairs $(u,v), (w,x), (y,z)$ is coprime (in lowest terms). Now we have $\{k, n, u, v, w, x, y, z\} \subset \mathbb{N}$, which is nice and convenient.

We can rearrange the equation to $$k^2=\prod_{p_i\mid k} \ p_i^{2e_i}=\frac uv\left(n-\frac wx\right)\left(n-\frac yz\right) = \frac uv \left(\frac{nx-w}{x}\right)\left(\frac{nz-y}{z}\right)=\frac{u(nx-w)(nz-y)}{vxz}$$

If we want an integer for $k$, then the numerator had best be divisible by the denominator, i.e., $vxz \mid u(nx-w)(nz-y)$. Note to start that $x \nmid nx-w, z \nmid nz-y$, and $v \nmid u$, due to coprimality of each pair.

So, as constraints, we have:

$$ \begin{align} v \mid nx-w &\lor v \mid nz-y \\ x \mid u &\lor x \mid nz-y \\ z \mid u &\lor z \mid nx-w \\ z \mid u &\lor x \mid u \end{align} $$

NB: If any of the original $a, b, c$ are integers, then some of $v,x,z$ are $1$, making things much simpler.

That first pair of constraints is pretty crucial: $v,w,x,y,z$ are known, so $n$ must be such that one of those criteria is true. In fact we can safely say that there must be some $j$ such that $n = (jv+w)/x$ or $n = (jv+y)/z$. Those constraints along with the original condition of the fractions being in lowest terms, imply that $(v,x) = 1 \lor (v,z) = 1$.

Hopefully you can get somewhere useful from these.


Extra note: The equation $k^2 = an^2 + bn+c$ is a hyperbola if we map $(n,k) \mapsto (x,y)$. The asymptotes of the hyperbola have slope $m = \pm \sqrt{a}$. That suggests that $a$ may have to be a square for there to be any solution at all. Nope, this thought was rubbish.

3
On

COMMENT.-Since $an^2+bn+(c-K)=0$, a necessary condition is that $b^2-4a(c-K)$ be a square $z^2$ and that $n=\dfrac{-b+z}{2a}$ so the "candidates" $n$ will be necessarily such that $-b$ plus a square be multiple of $2a$. This would be a first step.

The second step is to make with values of $z$ that $K=\dfrac{z^2+4ac-b^2}{4a}$ becomes a square.

I doubt there is an efficient method to solve this question even for small values of $a,b,c$.

WARNING.-For many values of positive rational $a,b,c$ the problem cannot have solution, for example for $$\dfrac{3x^2+5x+7}{12}$$