# The number of perfect squares which can occur in an arithmetic progression of length n

Let f(n) be the maximum number of squares in an AP (arithmetic progression) of length n. For example, $$f(3)=3$$, as 1, 25, 49 is a 3-term arithmetic progression with three squares, and $$f(4)=3$$, as there are no 4 term arithmetic progressions of squares. Also, $$f(5)=4$$, with the AP 49, 169, 289, 409, 529 as a small example.

Trivially, f is monotone increasing, as adding terms onto an existing AP cannot reduce the number of squares. Also, $$f(a+b) \leq f(a)+f(b)$$, by concatenation of sequences. It seems to me that the easiest way to find upper bounds on f is to constrain configurations of squares. Let $$(0, a, b, c)$$ (with $$0 denote a configuration of squares of the form: $$M, M+aK, M+bk, M+ck$$, where $$k>0$$. The configuration $$(0, 1, 2, 3)$$ is a four term arithmetic progression, which we already know is ruled out. Using elliptic curves you can show that $$(0, 1, 3, 4)$$ and $$(0, 1, 4, 5)$$ are also impossible (and it looks like many more are impossible as well. On the positive end, there are solutions for any configuration $$(0, a, b, c)$$ when $$c \neq a+b$$ (I'm working on a parametric solution).

By eliminating those configurations, I have found that $$f(6)=4$$, $$4 \leq f(7) \leq 5$$, and $$f(8)=5$$ with $$1, 25, 49, 73, 97, 121, 145, 169$$ as an example.

Up to what $$n$$ is $$f(n)$$ known? Specifically, are f(9) and f(10) known?

It's tabulated out to $$f(52)=12$$ at the Online Encyclopedia of Integer Sequences.
A conjecture is presented which gives a very simple form for $$f(n)$$ that works for all $$n\le52$$ except $$n=5$$.