Solving a function for square numbers Essentially I'm curious; could a perfect square($x$ squared) be less than the sum of all lesser perfect squares by a perfect square, and if so, what would the smallest solution be. Take $36$ for example, $36 < 25+16+9+4+1$ by $19$, $19$ is not a perfect square.
$\dfrac{(x(x+1)(2x+1))}{6}$ sums the squares so I substitute $x-1$ and take away the highest square and I get $\dfrac{(x(x-1)(2x-1))}{6}-x^2=$ "Perfect Square" how would you find if there exists any integers $x$ that satisfy such an equation? 
Thank you!

Here's a partial solution. I may return to this when I have time...
(EDIT: Daniel Fischer's solution completes this answer, and also provides the missing case.)
Suppose $\frac{x(x-1)(2x-1)}{6} - x^2 = k^2$ for some integer $k$. Rewriting:
$$ x(x-1)(2x-1)-6x^2 = 6k^2$$
$$ x(2x^2-9x+1)=6k^2$$
Let $y=2x^2-9x+1$, and note that $gcd(x,y)=1$. That means the prime factors of $k^2$ all occur either in $x$ or in $y$. There are three cases depending on how the factor $6$ is split between $x$ and $y$.
Case 1: $x=a^2, y = 6b^2$, where $k=ab$.
Then $6b^2 = 2a^4 - 9a^2+1$. Since $y$ is even, $a$ must be odd, therefore $a^2 \equiv 1$ (mod $8$), and the right hand side is $2 - 9 + 1 \equiv 2$ (mod $8$). If $b$ is even, the left hand side is divisble by 8, so $b$ must be odd, in which case $6b^2 \equiv 6 \not\equiv 2 $(mod $8$). Thus this case is discounted.
Case 2: $x = 2a^2, y = 3b^2$
We have $ 3b^2 = 8a^4 - 18a^2 +1$. The right hand side is odd, so $b$ is odd. Therefore $b^2 \equiv 1$ (mod $8$) and $3b^2 \equiv 3$ (mod $8$). But the right hand side is $-2a^2+1$ (mod $8$), which is $\pm 1$ (mod $8$) depending on whether $a$ is even or odd. Therefore, this case is also discounted.
Case 3: $x = 6a^2, y = b^2$
Then $b^2 = 72a^4 - 54a^2 +1$. 
I stopped here. The right hand side is not a square for values of $a$ between $1$ and $50000$. In that range, it's frequently squarefree; when it's not, one of the prime factors has exponent 2, very rarely 3.
See Daniel Fischer's answer for the rest.

The missing case was $x=3a^2$, $y=2b^2$. Here's a short way to deal with it:
$2b^2 = 18a^4 - 27a^2 +1$ implies $2b^2 \equiv 1$ (mod $3$) $\Rightarrow b^2 \equiv 2$ (mod $3$), which is not possible.
Also, Daniel's solution shows $72x^2 - 54x + 1$ is not a square for any integer $x>0$. 
