17. Find the smallest positive integer $n$ for which there are exactly 2323 positive integers less than or equal to $n$ that are divisible by 2 or 23 , but not both.
17. 4644
Solution. The number of positive integers from 1 to $n$ that are divisible by 2 or 23 , but not both, is
$$
f(n)=\left\lfloor\frac{n}{2}\right\rfloor+\left\lfloor\frac{n}{23}\right\rfloor-2\left\lfloor\frac{n}{46}\right\rfloor .
$$

We need to find $f(n)=2323$, which can be done by some trial and error.
Note that if $n$ is a multiple of 2 and 23 , then the floor divisions are non-rounded exact divisions, in which case,
$$
\frac{n}{2}+\frac{n}{23}-2 \frac{n}{46}=\frac{n}{2}
$$

So, for example, $f(4646)=2323$. We can then just tick downwards.
Since 4646 and 4645 do not satisfy our criteria, we know that $f(4646)=f(4645)=f(4644)$, i.e. we can remove 4646 and 4645 and the count does not go down (we weren't counting them). However, 4644 does satisfy our criteria, so $f(4643)=2322$.
Note that by definition, this function is non-decreasing. Thus, we conclude that $n=4644$ is the first $n$ that satisfies the given conditions.