If an integer is both a square and a cube, it can be of the form:
(a3)^2 
Now, 
since a cube can be of the form 7k or 7k+-1(thanks to FoolForMath),
 we write
a^3=7k 
and get the no to be 
49k^2
, which is in the form of 7 times something 
49k^2=7×(7k^2) 
Now put 
a^3=7k+−1 Square it 
and you'll get a number in the form of (7times something +1)