Since you do not know the number that will be written by the professor, you have to assume that he can write any of them. The following approach offers a way how to know all possible questions, given your action.
Let your number be denoted $a$ while the professor's $\omega$. The set of questions you can be asked, for given $a$ is
$$Q_a =\{i=(\omega+a)\%18|\omega\in I\}$$
where $I$ is the considered interval.
More information could be obtained if you would know the strategy how the professor writes $\omega$. Assuming that it is a random number with probability mass function $p(\omega)$, you can transform the $Q_a$ to conditional probability mass functions $p(i|a)$:
$$
p(i|a)=\sum_{\omega\in I:(a+\omega)\%18 =i}p(\omega)
$$
Afterwards, you can find $a$ that maximizes your chances
$$
a^{*}=\arg\min_{a} p(i|a) z(i)
$$
where $z(i)=0$ if you do not know the topic and $z(i)=1$ if you know it.
If you do not know the professor's strategy, you can ask your classmates for his choices and to reconstruct the strategy on your own. Alternatively, you can try some common sense strategies (uniform, for example).