Number which is Square and Cube Modulo 7

Theorem
Let $n \in \Z$ be an integer.

Let $n$ be both a square and a cube at the same time.

Then either:
 * $n \equiv 0 \pmod 7$

or:
 * $n \equiv 1 \pmod 7$

Proof
Let $n = r^2 = s^3$ for some $r, s \in \Z$.

Then:
 * $n = \paren {m^2}^3 = \paren {m^3}^2 = m^6$

for some $m \in \Z$

There are $7$ cases to consider:


 * $(0): \quad m \equiv 0 \pmod 7$: we have $m = 7 k$


 * $(1): \quad m \equiv 1 \pmod 7$: we have $m = 7 k + 1$


 * $(2): \quad m \equiv 2 \pmod 7$: we have $m = 7 k + 2$


 * $(3): \quad m \equiv 3 \pmod 7$: we have $m = 7 k + 3$


 * $(4): \quad m \equiv 4 \pmod 7$: we have $m = 7 k + 4$


 * $(5): \quad m \equiv 5 \pmod 7$: we have $m = 7 k + 5$


 * $(6): \quad m \equiv 6 \pmod 7$: we have $m = 7 k + 6$

Using Congruence of Powers throughout, we make use of:
 * $x \equiv y \pmod 7 \implies x^j \equiv y^j \pmod 7$

for $j \in \Z_{>0}$.

First the easy cases:

It is sufficient to investigate the congruence modulo $7$ of the integers from $2$ to $6$.

Then we have:

Hence the result.