diff --git a/cmd/primitiveRoot.go b/cmd/primitiveRoot.go index c06338c..c6c9961 100644 --- a/cmd/primitiveRoot.go +++ b/cmd/primitiveRoot.go @@ -29,6 +29,10 @@ var modulus string var tpf []string func computeNaive(modulus *big.Int) (*big.Int, error) { + if modulus.Cmp(big.NewInt(1)) == 0 { + return big.NewInt(0), nil + } + for g := big.NewInt(1); g.Cmp(modulus) == -1; g.Add(g, big.NewInt(1)) { e := big.NewInt(1) exps := make(map[string]big.Int)