  This paper studies one of the best known quantum algorithms - Shor's
factorisation algorithm - via categorical distributivity. A key aim of the
paper is to provide a minimal set of categorical requirements for key parts of
the algorithm, in order to establish the most general setting in which the
required operations may be performed efficiently.
  We demonstrate that Laplaza's theory of coherence for distributivity provides
a purely categorical proof of the operational equivalence of two quantum
circuits, with the notable property that one is exponentially more efficient
than the other. This equivalence also exists in a wide range of categories.
  When applied to the category of finite dimensional Hilbert spaces, we recover
the usual efficient implementation of the quantum oracles at the heart of both
Shor's algorithm and quantum period-finding generally; however, it is also
applicable in a much wider range of settings.
