Prime Periods

We shall suppose here that *p* is a prime which does not divide the base. Where it does divide the base, then it, and all of its powers will give a terminating reciprocal, such as 1/125 = 0.008 decimal, or 1/64 is 0.023 dozenal.

The prime period is found by repeatedly dividing the prime into 1,0 times the remainder. This for example, with 1/7 gives 0.142857142857... Since a remainder is carried to the right, starting from any position will give some fraction in the prime, so 0.7142857... is 5/7.

It produces a six-place period here because 7 divides 999999. Every number co-prime to the base will divide some b^n-1, and is thus said to have an n-place period. The b^n-1 (or *repomega*) number, is comprised of algebraic roots one for each divisor. If a prime has a six-place period, it divides A(6) = 91.

### Modular Loops

The modular loop is the successive remainders, starting with some *x* , of *10x*, *100x,*  etc, Because there are only *p-1* possible remainders, all loops must return to where it started from. The size of the loops are the same as the period. 10 has a six-place loop for both 7 and 13.

7: 1 , 3, 2, 6, 4, 5,

13: 1, 10, 9, 12, 3, 4 and 2, 7, 5, 11, 6, 8,

### Fermats Little Theorom

The period of a prime *p* divides *p-1*.

We start by showing that if *ax = bx*, then *a=b.* This means that two different integers can not map onto the next fraction. Where *ax=bx* then *p* divides (a-b)x, but since p does not divide x, then a=b, This means that all numbers 1 to p-1 fall in loops.

The second step is to show that if there is some *y* that does not fall in the loop with *x*, then there is a separate loop containing y with the same size as x. See for example the loops beginning 1, 2 in the previous section. Also, since there is no branching, the loop containing y contains no element in the loop containing x.

Since all numbers 1 to p-1 lie in equal-sized loops, then the period divides p-1.

### Primitive Roots (g)

There exists at least one value *g* for which the period passes through all p-1 values.

We suppose that *x* lies in a loop comprising of some *qr* elements. Then there is a loop of *r* steps that is formed by steps of *q* along the period. For example, in the case of 7 above, there is a loop of 3 formed by every second step (1, 2, 4) or (6, 5, 3).

We suppose that *p-1* = *qrs...* where q, r, s are co-prime. If we know values that produce periods of these lengths (as eg p and q), then their product will produce a period of the product pq.

For the case where Q is a square or higher power (say q^r), it will be noted that there is only one loop of period q that contains 1. There will be a number of loops of equal size, being (p-1)/q, and for some *y* not in the loop containing 1, one would derive a larger loop containing *y* that divides Q/q. This process continues to exhaustion, meaning that if Q is a power of q, there is still some g that includes all values.

### Indices

There is some minimal g, for which every value between 1 and p-1 is represented as g^i. Since this is an ordinary power equation, *i* functions as a kind of logrithm. In the example above, we note that 2 is a primitive root, the powers of 2 modulo 13 run

(0) 1, 2, 4, (3) 8 3 6 (6) 12 11 9 (9) 5 10 7 (12) 1

For any value, the period is the smallest number by which the index is multiplied by to get a multiple of p-1. So if the number is 5, the index here is 9, and 4 is the smallest number that gives a multiple of 12. This can be written as n = (p-1)/gcd(i, p-1)

Knowing the index for the primes (2 = 1, 3 = 4, 5 = 10), mod 12, the index of 120 is 3\*2+4+10 = 20 = 8 mod 12, and thus the period is 12/gcd(8,12) = 3. It is 0:09,27,83.