Azambuja writes a rational number $q$ on a blackboard. One operation is to delete $q$ and replace it by $q+1$; or by $q-1$; or by $\frac{q-1}{2q-1}$ if $q \neq \frac{1}{2}$. The final goal of Azambuja is to write the number $\frac{1}{2018}$ after performing a finite number of operations.
[b]a)[/b] Show that if the initial number written is $0$, then Azambuja cannot reach his goal.
[b]b)[/b] Find all initial numbers for which Azambuja can achieve his goal.
### Part (a)
1. **Initial Setup and Transformation:**
   - We start with the rational number \( q \).
   - The operations allowed are:
     - \( q \to q + 1 \)
     - \( q \to q - 1 \)
     - \( q \to \frac{q-1}{2q-1} \) if \( q \neq \frac{1}{2} \)

2. **Transformation Analysis:**
   - Consider the transformation \( q' = \frac{q-1}{2q-1} \).
   - We derive the relationship between \( q \) and \( q' \):
     \[
     q + q' = 2qq' + 1
     \]
   - Let \( u = q - \frac{1}{2} \) and \( u' = q' - \frac{1}{2} \). Then:
     \[
     u = q - \frac{1}{2}, \quad u' = q' - \frac{1}{2}
     \]
   - Substituting these into the relationship, we get:
     \[
     \left( q - \frac{1}{2} \right) + \left( q' - \frac{1}{2} \right) = 2 \left( q - \frac{1}{2} \right) \left( q' - \frac{1}{2} \right) + 1
     \]
     Simplifying, we find:
     \[
     u + u' = 2uu' + 1
     \]
     \[
     u + u' = 2uu' + 1
     \]
     \[
     uu' = -\frac{1}{4}
     \]

3. **Further Simplification:**
   - Let \( v = 2u \) and \( v' = 2u' \). Then:
     \[
     v = 2 \left( q - \frac{1}{2} \right), \quad v' = 2 \left( q' - \frac{1}{2} \right)
     \]
   - This implies:
     \[
     vv' = -1
     \]

4. **Initial Condition:**
   - Starting from \( q = 0 \):
     \[
     u = 0 - \frac{1}{2} = -\frac{1}{2}
     \]
     \[
     v = 2 \left( -\frac{1}{2} \right) = -1
     \]

5. **Transformation Rules:**
   - We can either:
     - Add \( \pm 2 \) to \( v \)
     - Flip to \( v' \) such that \( vv' = -1 \)

6. **Pair Representation:**
   - Let \( v = \frac{r}{s} \) where \( r \) and \( s \) are integers.
   - The transformations are:
     - \( \left( \frac{r}{s} \right) \to \left( \frac{r \pm 2s}{s} \right) \)
     - \( \left( \frac{r}{s} \right) \to \left( \frac{-s}{r} \right) \)

7. **Initial Pair:**
   - Starting from \( v = -1 \):
     \[
     \left( \frac{-1}{1} \right)
     \]
   - This pair can only transform into pairs of the form \( (\text{odd}, \text{odd}) \).

8. **Target Pair:**
   - The target \( \frac{1}{2018} \) corresponds to:
     \[
     v = 2 \left( \frac{1}{2018} - \frac{1}{2} \right) = -\frac{1008}{1009}
     \]
   - This corresponds to the pair \( (-1008, 1009) \), which is \( (\text{even}, \text{odd}) \).

9. **Conclusion for Part (a):**
   - Since we can only reach pairs of the form \( (\text{odd}, \text{odd}) \) starting from \( (-1, 1) \), it is impossible to reach \( (-1008, 1009) \).

\(\blacksquare\)

### Part (b)
1. **General Case Analysis:**
   - To reach \( (-1008, 1009) \), we need to start from a pair \( (r, s) \) with \( \gcd(r, s) = 1 \) that is not \( (\text{odd}, \text{odd}) \).

2. **Possible Initial Pairs:**
   - Any pair \( (r, s) \) with \( \gcd(r, s) = 1 \) and not both odd can be transformed to \( (-1008, 1009) \).

3. **Conclusion for Part (b):**
   - The initial numbers \( q \) for which Azambuja can achieve his goal are those that correspond to pairs \( (r, s) \) with \( \gcd(r, s) = 1 \) and not both odd.

\(\blacksquare\)

The final answer is \( \boxed{\text{All initial numbers } q \text{ such that } (r, s) \text{ with } \gcd(r, s) = 1 \text{ and not both odd}} \)