Context: I am designing an online test for students where they shall construct a (normalized) polynomial $p$ with $\deg(p)=3$ $$p:\mathbb R\rightarrow\mathbb R,~x\mapsto x^3+bx^2+cx+d$$ where $b,c,d$ should be integers; they are given information about some roots of the function and/or about roots of the first derivative (meaning: they are told that for $x=x_0$ there should be a local minimum/maximum). I want the test to be repeatable in such a way, that the students get new information/they need to construct a new function if they repeat the test. I also want the given information to be integers (no one wants to deal with fractions or worse, square roots when solving a system of linear equations). Therefore I made the following assumptions:
- The polynomial shall have 3 distinct, integer roots. I also want two of those roots be smaller than zero, the third one should be greater than zero which gives us $$f(x)=(x+r)(x+s)(x-t).$$
- The derivative shall have 2 disctint, integer roots, one should be smaller than zero, the other greater than zero which gives us $$f'(x)=3(x+b')(x-c').$$
Expanding and equating the coefficients gives us: $$\frac{3}{2}(b'-c')=(r+s-t)=b,\quad -3b'c'=rs-rt-st=c$$ and $$-rst=d.$$
To take care of the "it should be integers" part we need
$$r+s-t=3k,\quad rs-rt-st=3l,\quad k,l\in\mathbb Z$$
which yields the following solutions for $r,s$ and $t$:
$$r=3n_2+2,\quad s=3n_3+2, \quad t=-9n_1+3n_2+3n_3+1.$$
(Not sure why I did this, I included it just because it is on my handwritten notes)
This so far only allows me to give my students 3 randomly generated roots of $p$, not roots of $p'$. So lets take a look at the equations we derived for $b$ and $c$: $$\frac{3}{2}(b'-c')=(r+s-t),\quad -3b'c'=rs-rt-st.$$ If I take these two equations and (assuming that $c'\neq 0$) solve for $c'$, I get: $$c'=\frac{1}{3}\left(\sqrt{r^2-rs+rt+s^2+st+t^2}-r-s+t\right).$$ So let's say that I want to give them $r,s$ and $c'$ (all integers), I first need $$r^2-rs+rt+s^2+st+t^2$$ to be a square number. At this point I wouldn't care to much if $c'$ is no integer, having a fraction with $3$ in the denominator for some choices of $r,s,t$ is fine. So the question is:
Question: for which $r,s,t\in\mathbb N$ is $$r^2-rs+rt+s^2+st+t^2=k^2,k\in\mathbb N$$ a square number?
Using WolframAlpha I got a few alternate forms, all of which weren't perfect squares. Using trial and error I got a few values for $r,s,t$ that would work, though I always had that at least two variables were equal, e.g. $r=s=2,t=5$ works (this of course results in the polynomial not having 3 distinct but only 2 distinct roots).
Subquestion: do pairwise distinct $r,s,t$ exist with the properties as bove?
Any input on how I get all/some values for $r,s,t$ is appreciated.
Edit: with the thread linked by mathlove:
For $l,m,n\in\mathbb N$ we get \begin{align*}k=l(mn-m^2-n^2), \\ r-s=l(n^2-2mn), \\ s+t=l(m^2-n^2).\end{align*} Now let $t\in\mathbb N$ and solve for $r$ and $s$: \begin{align*}s=l(m^2-n^2)-t,\\r=l(m^2-2mn)-t.\end{align*}
This gives nice values for $r,s,t$ and $c'$. The only thing to consider is the range for $l,m,n,t$, as you can get quite some big coefficients in the polynomial.