TITLE: A problem on divisibility theorem
QUESTION [7 upvotes]: Verify that if an integer is simultaneously a square and a cube, then it must be either of the form ${7k}$ or ${7k +1}$.

I have no idea on how to proceed.

REPLY [14 votes]: Suppose that $\,\color{#c00}{a^{k}} =n = \color{#0a0}{b^{k+1}}$ and  $\  k(k\!+\!1)+1 = p\,$ is prime. $ $ By $\ \color{#c0d}{\mu F} = $ little Fermat
mod $\,p\!:\ \,n\not\equiv 0\,\Rightarrow a,b\not\equiv 0\,\Rightarrow\ n\equiv\dfrac{n^{\large k+1}}{n^{\large k}\ \ \ \ }\equiv \dfrac{(\color{#c00}{a^{\large k}})^{\large k+1}}{(\color{#0a0}{b^{\large k+1}})^{\large k}}\equiv\dfrac{a^{\large p-1}}{b^{\large p-1}}\,\overset{\color{#c0f}{\mu F}}\equiv\, \dfrac{1}{1}\equiv 1\ $ 
Hence  $\ n\equiv 0\ $ or $\,1\pmod p,\ $ i.e. $\ n = pj\,$ or $\,1\!+\!pj\,$ for some $\,j\in \Bbb Z.\ \ $ QED
Yours is the special case $\ k = 2,\,$ so $\, p = 7.$

REPLY [5 votes]: If an integer $a$ is simultaneously a square and a cube, it must be the sixth power of an integer $b$
Now as $7$ is prime either $7|b$ or $(7,b)=1$
If $7|b, 7|b^n$ for integer $n\ge1$
Else by Fermat's Little Theorem , $7|(b^{7-1}-1)$