Peter wrote:
Find all functions $f:\mathbb{Q}^{+} \to \mathbb{Q}^{+}$ such that for all $x\in \mathbb{Q}^+$:
$f(x+1)=f(x)+1 \ \ (*)$,
$f(x^2)=f(x)^2 \ \ (**)$.
$(*)$ yields that (prove it via induction) $\forall i \in \mathbb{N}, f(x+i) = f(x) + i.$
Now, let $r = f \left(\frac pq \right),$ so that $f \left(\frac pq + iq \right) = r+iq$ and $f \left(\left(\frac pq + iq \right)^2 \right) = r^2 + 2irq + i^2q^2.$ On the other hand, $f \left(\left(\frac pq + iq \right)^2 \right) = f \left(\left(\frac pq \right)^2 \right) + 2ip + i^2q^2 = r^2 + 2ip + i^2q^2.$
Hence $2irq = 2ip \implies r = \frac pq.$
Conversely, $\text{Id}$ clearly satisfies the requirements.