Generators in Zp

An Interactive Applet powered by Sage and MathJax.

(By Alyssa Vorpahl and Prof. Gregory V. Bard)


This page will discuss what it means for a member of the group Z mod p to be a generator of that group.


You may recall from the previous interact that we discussed the idea of analyzing the sequence g0=1, g1=g, g2, g3, ... looking for repetitions, and how it led to the concept of 'generators'. For an element g in a group G to generate G, the following two equivalent statements must be true:

In other words, gi must repeat itself at the last possible moment. Then, since there is a number of distinct gi's equal to the number of group elements, each element of the group can be written as gi for some i. Thus, by g being raised to increasing powers, the sequence g0=1, g1=g, g2, g3, ... has listed the entire group.


This app will allow you to select a base number (g) and the modulus (p). It will then raise g to each power between 0 and Phi(p), marking any repeated results. If there are no repeats, then it will notify you that the group element g is, in fact, a generator.

Also, notice that we refer to the modulus as p instead of N here. This is because we are only considering prime values for the modulus.

Once you load the applet, there will be two sliders: one to control the g value, and one to control the modulus p.

Last modified by Alyssa Vorpahl on December 6th, 2018. Updated to Python 3 by Prof. Bard on April 7th, 2020.