  These are pedagogical notes on Shor's factoring algorithm, which is a quantum
algorithm for factoring very large numbers (of order of hundreds to thousands
of bits) in polynomial time. In contrast, all known classical algorithms for
the factoring problem take an exponential time to factor large numbers. In
these notes, we assume no prior knowledge of Shor's algorithm beyond a basic
familiarity with the circuit model of quantum computing. The literature is
thick with derivations and expositions of Shor's algorithm, but most of them
seem to be lacking in essential details, and none of them provide a pedagogical
presentation. We develop the theory of modular exponentiation (ME) operators in
some detail, one of the fundamental components of Shor's algorithm, and the
place where most of the quantum resources are deployed. We also discuss the
post-quantum processing and the method of continued fractions, which is used to
extract the exact period of the modular exponential function from the
approximately measured phase angles of the ME operator. The manuscript then
moves on to a series of examples. We first verify the formalism by factoring
N=15, the smallest number accessible to Shor's algorithm. We then proceed to
factor larger numbers, developing a systematic procedure that will find the ME
operators for any semi-prime $N = p \times q$ (where $q$ and~$p$ are prime).
Finally, we factor the numbers N=21, 33, 35, 143, 247 using the Qiskit
simulator. It is observed that the ME operators are somewhat forgiving, and
truncated approximate forms are able to extract factors just as well as the
exact operators. This is because the method of continued fractions only
requires an approximate phase value for its input, which suggests that
implementing Shor's algorithm might not be as difficult as first suspected.
