<s>[INST] Q27 from AMC 2012(Senior): Five consecutive integers that sum to a perfect square, and the three middle terms sum to a perfect cube. 
Five consecutive integers $p,q,r,s,t$,each less than $10000$, produce a sum which is a perfect square, while the sum of $q,r,s$ is a perfect cube.What is the value of $ \sqrt{p+q+r+s+t}$ ?

What I have tried so far:
Let $p=r-2$
$p+q+r+s+t =5r $
$5r=x^2 $
$q+r+s =3r =y^3 $
$x^2 -y^3 =2r $
So,the only perfect squares which are divisible by $5$ are the multiples of $5$: $25,100,225,400...$
I also observed that $100-25=75,225-100=125$,where $125-75=50$.Trying that for $225-100=125,400-225=175$ where $175-125=50$
Then,for the perfect cube which are divisible by 3 and must be less than the perfect squares.
$30^3,60^3,90^3,120^3....$
And here is were I got stuck at...
Is the concept I'm using correct?
 [/INST] The problem is that of finding the value of $\sqrt{5p+10}$ where $p$ is an integer less than 9995 such that
$$a^2=p+(p+1)+(p+2)+(p+3)+(p+4)=5p+10=5(p+2),$$
$$b^3=(p+1)+(p+2)+(p+3)=3p+6=3(p+2),$$
for some integers $a$ and $b$. Then $5\mid a$ and $3\mid b$, and hence $5\mid p+2$ and $3^2\mid p+2$, meaning that
$$p=45n-2,$$
for some integer $n$. It follows that
$$a^2=225n=3^2\times5^2\times n\qquad\text{ and }\qquad b^3=135n=3^3\times5\times n.$$
we see that the right-hand sides are squares resp. cubes for $n=5^2$. This yieds $p=1123$ and hence
$$a^2=5p+10=75^2\qquad\text{ and }\qquad b^3=3p+6=15^3.$$
Note that the next value of $n$ that works is $n=3^6\times5^2>10000$ and that $n$ cannot be negative, so
$$\sqrt{p+q+r+s+t}=75.$$
</s>