A standard method for detecting periodicity in single-step recurrences is Floyd's
algorithm, described in [6,7]. Having computed
,
one tests whether
. If
is periodic with
for
minimal m and p, and if n = sp satisfies
, then
.
Once n = sp is found, one determines p by finding the minimal divisor of n for
which
. Finally, one finds m by testing whether
for
.
Annotation Form Interface