Skip to content

Commit

Permalink
Update hooklength.go
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzotinfena committed Mar 27, 2024
1 parent 8bcaf51 commit 3274599
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions math/combinatorics/hooklength.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ package combinatorics
import "github.com/lorenzotinfena/goji/math"

func HookLength(partition []int, primeMod int) int {
partitionTrasnposed := []int{}
j := 0
for i := len(partition) - 1; i >= 0; i-- {
for j < partition[i] {
partitionTrasnposed = append(partitionTrasnposed, i+1)
j++
}
partitionTrasnposed := make([]int, partition[0])
for i := 0; i < len(partition); i++ {
partitionTrasnposed[partition[i]-1] = i + 1
}

productOfHookLengths := 1
Expand All @@ -21,6 +17,7 @@ func HookLength(partition []int, primeMod int) int {
productOfHookLengths %= primeMod
}
}

hookLength := math.Factorial(n, primeMod) * math.ModularInverse(productOfHookLengths, primeMod)
hookLength %= primeMod
return (hookLength * hookLength) % primeMod
Expand Down

0 comments on commit 3274599

Please sign in to comment.