Let $n$ be a 6-digit number, perfect square and perfect cube. If $n-6$ is not even or a multiple of 3, find $n$.
Playing with the first ten perfect squares and cubes I ended with:
The last digit of $n \in (1,5,9)$
If $n$ last digit is $9$, then the cube ends in $9$, Ex: if $n$ was $729$, the cube is $9^3$ (ends in $9$) and the square ends in $3$ or $7$
If $n$ last digit is 5, then the cube ends in 5 and the square ends in 5
If $n$ last digit is 1, then the cube ends in 1 and the square ends in 1
By brute force I saw that from $47^3$ onwards, the cubes are 6-digit, so I tried some cubes (luckily for me not for long) and $49^3 = 343^2 = 117649$ worked.
So I found $n=117649$ but I want to know what is the elegant or without brute force method to find this number because my method isn't very good, just pure luck maybe.