# How many such squares can be formed?

$S$ is a set of all points $(a, b)$ such that $0 ≤ a$, $b ≤ k$. How many squares are there such that all the $4$ vertices are from set $S$?

For diagonal squares, a square must contain odd points on its side. so that we can join the mid points of each side. suppose we take $5$ points on each side, $$5*5 will make = 1^{2}$$ $$3*3 will make = 3^{2}$$ etc

so when $n$ is odd, its summation of all odd squares till $k$. & for even similar approach.

-

I think it's this sequence. It says, "$a(n) =$ number of squares with corners on an $n\times n$ grid."

-