From a7547fc0eb21ff1d1f361f4c1775f9b7913b17ed Mon Sep 17 00:00:00 2001 From: filifa Date: Tue, 19 Aug 2025 22:00:14 -0400 Subject: [PATCH] add special case for modulus=1 --- cmd/primitiveRoot.go | 4 ++++ 1 file changed, 4 insertions(+) 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)