reorganize loop

This commit is contained in:
filifa 2025-09-06 00:04:26 -04:00
parent cafef6a4a2
commit 67c95db7ba
1 changed files with 6 additions and 4 deletions

View File

@ -42,13 +42,15 @@ func gaussianBrackets(ch <-chan *big.Int) <-chan *big.Int {
x := big.NewInt(1)
go func() {
out <- big.NewInt(1)
tmp := new(big.Int)
for a := range ch {
tmp := new(big.Int).Mul(a, x)
out <- x
tmp.Mul(a, x)
tmp.Add(tmp, xprev)
xprev.Set(x)
x.Set(tmp)
out <- tmp
x = new(big.Int).Set(tmp)
}
}()