The equation is equivalent to:
$$q=\log_{64}(3n+1)$$
or
$$n=\frac{64^q-1}3$$
Since $64\equiv 1\pmod 3$, $n$ is an integer. And since $64^q-1$ is odd, $n$ is odd. So you only have to substitute $q$ for odd numbers, and you get the possible values of $n$.
The equation is equivalent to: $$q=\log_{64}(3n+1)$$ or $$n=\frac{64^q-1}3$$
Since $64\equiv 1\pmod 3$, $n$ is an integer. And since $64^q-1$ is odd, $n$ is odd. So you only have to substitute $q$ for odd numbers, and you get the possible values of $n$.