<s>[INST] If $\ell=6m-1$ is prime then $\ell\ne3\frac{j^2+3k^2}{j+3k}$ Let $\ell=6m-1$ for some integer $m\ge1$ be a prime and for any integer $1\le j\le (\ell-1)/2$, $$\dfrac{(j-m)(3j-3m+1)}{2}\neq\dfrac{\ell^2-1}{24}.$$ Then, I need a proof for the inequality that for integers $1\le j,k\le (\ell-1)/2$, $$\dfrac{(j-m)(3j-3m+1)}{2}+\dfrac{3(k-m)(3k-3m+1)}{2}\neq\dfrac{\ell^2-1}{6}.$$
Assuming $$\dfrac{(j-m)(3j-3m+1)}{2}+\dfrac{3(k-m)(3k-3m+1)}{2}=\dfrac{\ell^2-1}{6}$$ and simplification by $\ell=6m-1$ gives that $$\ell=3\dfrac{j^2+3k^2}{j+3k}.$$ If $3\nmid (j+3k)$, $\ell$ is not a prime, which is a contradiction. Now, I have not been able to conclude with a contradiction when $3\mid (j+3k)$. Other proofs are welcome. Thanks in advance.
 [/INST] For $3|j+3k$, we must have $3|j$. Then, let $j=3t$ for some integer $t$. Then
$$\ell=\frac{3(j^2+3k^2)}{j+3k}=\frac{3(9t^2+3k^2)}{3(t+k)}=\frac{3(k^2+3t^2)}{t+k}.$$
So, $3|t+k$. Let $k=3u-t$; then
$$\ell=\frac{(3u-t)^2+3t^2}u=\frac{4t^2-6tu+9u^2}u.$$
So, $u|4t^2$. Consider any prime $p|u$. Also, since
$$u=\frac j9+\frac k3<\ell-1,$$
$p\neq \ell$. Letting
$$t=p^\alpha r,\ u=p^\beta s$$
with $p\nmid r,s$, we have
$$0=\nu_p(\ell)=\nu_p\left(\frac{4p^{2\alpha}r^2-6p^{\alpha+\beta}rs+9p^{2\beta}s^2}{p^\beta s}\right)\geq 2\min(\alpha,\beta)-\beta,$$
so $2\min(\alpha,\beta)\leq \beta$. Since $\beta>1$, $\min(\alpha,\beta)<\beta$, and so it must be $\alpha$, giving $2\alpha\leq \beta$. However, for $p$ odd, $u|4t^2$ gives $2\alpha\geq\beta$, so $2\alpha=\beta$. For $p=2$, $u|4t^2$ gives $\beta\leq 2\alpha+2$. This means that $u$ is one of $\{t^2,2t^2,4t^2\}$.
If $u=2t^2$, then
$$\ell=2-6t+9u=18t^2-6t+2,$$
which is even. Otherwise,
$$\ell=[1\text{ or }4]-6t+9u\equiv 1\pmod 3,$$
a contradiction since $\ell=6m-1$. So, we are done.
</s>