Combinatorics.jl
Combinatorics.jl copied to clipboard
Add hooklength
I have the following code that calculates the hooklength of a partition. I'll put in a PR when I get time:
function hooklength(σ::Vector{Int})
ret = 1
m = length(σ)
for k = 1:m, j=1:σ[k]
ret_2 = 0
ret_2 += σ[k]-j
for p = k:m
σ[p] < j && break
ret_2 += 1
end
ret *= ret_2
end
factorial(sum(σ)) ÷ ret
end
Note it's not really robust to overflow, I don't know a way to get around this other than using BigInt.