In mathematics, a periodic sequence (sometimes called a cycle) is a sequence for which the same terms are repeated over and over: a1, a2, ..., ap, a1, a2, ..., ap, a1, a2, ..., ap, ... The number p of repeated terms is called the period (period). A (purely) periodic sequence (with period p), or a p-periodic sequence, is a sequence a1, a2, a3, ... satisfying an+p = an for all values of n. If a sequence is regarded as a function whose domain is the set of natural numbers, then a periodic sequence is simply a special type of periodic function. The smallest p for which a periodic sequence is p-periodic is called its least period or exact period. Every constant function is 1-periodic. The sequence is periodic with least period 2. The sequence of digits in the decimal expansion of 1/7 is periodic with period 6: More generally, the sequence of digits in the decimal expansion of any rational number is eventually periodic (see below). The sequence of powers of −1 is periodic with period two: More generally, the sequence of powers of any root of unity is periodic. The same holds true for the powers of any element of finite order in a group. A periodic point for a function f : X → X is a point x whose orbit is a periodic sequence. Here, means the n-fold composition of f applied to x. Periodic points are important in the theory of dynamical systems. Every function from a finite set to itself has a periodic point; cycle detection is the algorithmic problem of finding such a point. Where k and m