Combinatorics.jl icon indicating copy to clipboard operation
Combinatorics.jl copied to clipboard

Add hooklength

Open dlfivefifty opened this issue 7 years ago • 1 comments

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

dlfivefifty avatar Mar 07 '18 10:03 dlfivefifty

Note it's not really robust to overflow, I don't know a way to get around this other than using BigInt.

dlfivefifty avatar Mar 07 '18 10:03 dlfivefifty