Q:

A natural number is a perfect square as well as a perfect cube. Show that it is $0$ or $1$ $ ($mod $7$ $)$.

A natural number is a perfect square as well as a perfect cube. Show that it is $0$ or $1$ $($mod $7$$)$. 
I tried the following.
There are integers numbers $x,y$ such that $n=x^{2}=y^{3}.$ By using Euclidean division, then $x$ and $y$ can be written as $7k,7k+1,7k+2,7k+3,7k+4,7k+5$ or $7k+6$. I am trying some contradictory stuff.
I don't know from where to go from here. Please suggest some hints.

A:

You know that all the squares are equals to $0,1,2$ or $4$ mod $7$ because:
$$0^2=0\pmod 7$$
$$1^2=1\pmod 7$$
$$2^2=4\pmod 7$$
$$3^2=2\pmod 7$$
$$4^2=2\pmod 7$$
$$5^2=4\pmod 7$$
$$6^2=1\pmod 7.$$
And all the cubes are equals to $0,1$ or $6$ mod $7$ because:
$$0^3=0\pmod 7$$
$$1^3=1\pmod 7$$
$$2^3=1\pmod 7$$
$$3^3=6\pmod 7$$
$$4^3=1\pmod 7$$
$$5^3=6\pmod 7$$
$$6^3=6\pmod 7.$$
So if your number is a square and a cube at the same time, then it is necessarily equal to $0$ or $1$ mod $7$.

