# Measuring ancillas in Shor's algorithm

When considering Shor's algorithm, we use ancilla qubits to effectively obtain the state $$\sum_x \left|x,f(x)\right>$$ for the function $f(x) = a^x \mod N$.

As I have learned it, we then measure the ancilla qubits, to obtain, say $f(x) = b$ and get the state $$\sum_{x\mid f(x) = b} \left|x,f(x)\right>.$$

Then applying a QFT will give the period. However, I think that the measurement of the ancilla qubits is not necessary, in order to be able to apply the QFT (or its inverse for that matter) and do a measurement to obtain the period.

Is that correct? Is it necessary to measure the ancilla qubits in Shor's algorithm?