  The study of quantum finite automata (QFAs) is one of the possible approaches
in exploring quantum computers with finite memory. Despite being one of the
most restricted models, Moore-Crutchfield quantum finite automaton (MCQFA) is
proven to be exponentially more succinct than classical finite automata models
in recognizing certain languages such as $\mathtt{MOD}_p = \{ a^{j} \mid j
\equiv 0 \mod p\}$, where $p$ is a prime number. In this paper, we present a
modified MCQFA algorithm for the language $\mathtt{MOD}_p$, the operators of
which are selected based on the basis gates on the available real quantum
computers. As a consequence, we obtain shorter quantum programs using fewer
basis gates compared to the implementation of the original algorithm given in
the literature.
