Pick two integers $a$ and $b$, and construct the arithmetic progression $an+b$. My question is, when does this contain infinitely many squares? And which terms in that sequence are the squares (i.e., for which $n$)?
For instance:
$2n+3$ is a square infinitely often (by setting $n=2m^2+2m-1$ for $m\in\bf Z$),
Similarly $5n+1$ is a square when $n=0,3,7,16,\dots$. This time the formula for which $n$ to take is not as simple, it's $n=\frac{1}{8} \left(10 m^2+2 \left((-1)^m-5\right) m+(-1)^{m+1}+1\right)$.
$9n+4$ is a square whenever $n=9m^2+4m$, but
$9n+5$ is never a square
$8n+1$ is a square when $n$ is triangular
Can someone point me to a general study of this diophantine problem, $k^2=an+b$?
In general, saying that there are infinitely many $an + b$ being square is the same as saying that $b$ is a quadratic residue mod $a$. Because if $b$ is a quadratic residue mod $a$, there exists $c$ such that $c^2 \equiv b \pmod{a}$. Note that all numbers in the form of $c + ka$ have their squares in the form of $an + b$.
To determine if a number $b$ is a quadratic residue mod $a$, there are ways to calculate that (Jacobi symbol with the help of quadratic reciprocity).