I am reading Nielsen and Chuang's "Quantum Computation and Quantum Information". One important concept about algorithms is how the number of operations scales with the length of the input. I realized I might not be getting what they actually mean by this in Exercise 5.17:
Part (1) is OK. In part (2) I think there is a typo. According to the answer to this question, it should read "$y=\log_2 N$" rather than just "$\log_2 N$". Then, what I understand the algorithm is doing in that step is computing $x=\log_2N/b$ for each $b \leq L$. These are $O(L)$ operations rather than $O(L^2)$ as it claims. Where are the other $O(L)$ operations?
I have thought perhaps these numbers don't agree because you have to take into account the number of operations required for elementary mathematical operations (see e.g. here), and computing $2^x$ takes more than one operation. But if I take into account the complexity of $2^x$, then I should also take into account the complexity of division in $x = \log_2 N/b$. Moreover, I don't think they are referring to this, because I have read all the chapters until here and I don't remember that they have explained this.