Source: https://pi.math.cornell.edu/~kbrown/6310/primitive.pdf