Square terms in an AP

38 Views Asked by At

Suppose we have an Arithmetic Progression given by

$$ a_n = a_0 + nd $$

Suppose $a_0 = k^2$ is a perfect square. We are looking for $m$ such that $a_m = s^2$.

Is there an intelligent way to search for square terms contained in an AP?

Example:

$$a_0 = 49^2, d = -6$$

The AP is

$$ \begin{align} & \textbf{2401},2395,2389,2383,2377,2371,2365,2359, \newline & 2353,2347,2341,2335,2329,2323,2317,2311, \newline & 2305,2299,2293,2287,2281,2275,2269,2263, \newline & 2257,2251,2245,2239,2233,2227,2221,2215, \newline & \textbf{2209},2203, \cdots, 1867,1861,1855, \newline & \textbf{1849},1843,1837,\cdots,1693,1687, \newline & \textbf{1681},1675,1669,\cdots \end{align} $$

The first term is $2401 = 49^2$ and the next square term is $2209 = 47^2$.

We also have $1849 = 43^2$ and $1681 = 41^2$. The square terms are shown in bold above.

I am currently just brute-forcing the search. Is there a better way?