diff --git a/lib/wordrep.gi b/lib/wordrep.gi index 3bbfd28004..6c8a876439 100644 --- a/lib/wordrep.gi +++ b/lib/wordrep.gi @@ -219,9 +219,9 @@ local a,n,t, or (IsInt(PRINTWORDPOWERS) and Length(l)true then if Length(l)>0 and n=infinity then - n:=2*(AbsInt(Maximum(l))+1); + n:=2*(Maximum(List(l,AbsInt))+1); fi; - a:=FindSubstringPowers(l,n); + a:=FindSubstringPowers(l,n+Length(tseed)); # tseed numbers are used already else a:=[l,[]]; fi; diff --git a/tst/testbugfix/2020-01-13-wordprint.tst b/tst/testbugfix/2020-01-13-wordprint.tst new file mode 100644 index 0000000000..6c5356588a --- /dev/null +++ b/tst/testbugfix/2020-01-13-wordprint.tst @@ -0,0 +1,4 @@ +# Assoc. word printing, #3845 +gap> f:=FreeGroup("x","y");;AssignGeneratorVariables(f); +gap> y^4*(y^2*(y*x)^2)^2*y^-7*x*y^16; +y^4*(y^2*(y*x)^2)^2*y^-7*x*y^16