  This paper proves the NP-completeness of the reachability problem for the
class of flat counter machines with difference bounds and, more generally,
octagonal relations, labeling the transitions on the loops. The proof is based
on the fact that the sequence of powers $\{R^i\}_{i=1}^\infty$ of such
relations can be encoded as a periodic sequence of matrices, and that both the
prefix and the period of this sequence are $2^{\mathcal{O}(\bin{R})}$ in the
size of the binary encoding $\bin{R}$ of a relation $R$. This result allows to
characterize the complexity of the reachability problem for one of the most
studied class of counter machines \cite{cav10,comon-jurski98}, and has a
potential impact for other problems in program verification.
