In general suppose you want to know if $\frac ab$ is an integer,
where $a$ is whatever you put in the numerator of your formula and $b$ is
whatever you put in the denominator.
(For example, when you ask about $\frac{2^x - 1}{18},$
then $a = 2^x - 1$ and $b = 18$.)
That is, you have $a$ and $b$ from somewhere and you want to know if
$\frac ab = k$ for some integer $k.$
This is the same as asking whether $a = bk$ for some integer $k.$
You can often solve this by finding a prime number that you can show divides one side but does not divide the other.
Sometimes you can do a little algebra to get a new equation and then find a prime number that divides one side and not the other.
For example, for $\frac{2^x}{3}$ you want to know if it is possible that
$2^x = 3k$ for some integer $k.$
But $3$ is a factor on the right side and not on the left side, so the answer is no.
As another example, for $\frac{2^x - 3}{9}$
the question is whether $2^x - 3 = 9k$ for some integer $k.$
That's the same as whether $2^x = 9k + 3$ for some integer $k.$
Again there's a factor of $3$ on the right but not on the left.
For $\frac{2^x - 1}{6}$
the question is whether $2^x - 1 = 6k$ for some integer $k.$
That's the same as whether $2^x = 6k + 1$ for some integer $k.$
Now there's a factor of $2$ on the left but not on the right.
Somewhat more generally, if you take successive powers of a number,
for example $2^x$ for $x = 1, 2, 3, \ldots,$
and each time take the remainder after dividing by some other fixed number,
for example $18,$
there are only a finite number of possible remainders you can have, and after some time you will see one of them occur again.
Once that happens, you can be sure that the same remainder will occur again and again, interleaved with the same sequence of other remainders every time.
In this example:
$2^1$ has remainder $2$ when divided by $18.$
$2^2$ has remainder $4$ when divided by $18.$
$2^3$ has remainder $8$ when divided by $18.$
$2^4$ has remainder $16$ when divided by $18.$
$2^5$ has remainder $14$ when divided by $18.$
$2^6$ has remainder $10$ when divided by $18.$
$2^7$ has remainder $2$ when divided by $18.$
And now the remainders will repeat forever: $4, 8, 16, 14, 10, 2.$
The remainder of $2^x - 1$ in each case also can take only a finite number of values, and it ends up repeating at the same frequency as $2^x.$
So it is possible to determine within a finite number of calculations what all possible values of the remainder of $2^x - 1$ are when divided by $18,$
and confirm that none of them is zero.