remove extraneous commented binomial implementation

This commit is contained in:
Thomas (Tom) C. Gorordo 2024-09-03 22:25:43 -07:00 committed by GitHub
parent 85c7cd2026
commit 8e3d78114e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -385,26 +385,6 @@ function sumlist!(list::Vector{<:PrimeFactorization}, ind = 1:length(list))
return MPZ.mul!(s, _convert!(i, g)) return MPZ.mul!(s, _convert!(i, g))
end end
#=
# A cached binomial implementation.
bcache = LRU{Tuple{BigInt, BigInt}, PrimeFactorization}(; maxsize=10^6)
function primebinomial(n::BigInt, k::BigInt)
T = PrimeFactorization{eltype(eltype(factorialtable))}
if k == 0
return one(T)
end # guard
if haskey(bcache, (n, k))
return bcache[(n, k)]
else
den = primefactor(k)
num = mul!(copy(primefactor(n + 1 - k)), primebinomial(n, k - 1))
res = divexact!(num, den)
bcache[(n, k)] = res
return res
end
end
=#
function primebinomial(n::BigInt, k::BigInt) function primebinomial(n::BigInt, k::BigInt)
num = copy(primefactorial(n)) num = copy(primefactorial(n))
divexact!(num, primefactorial(k)) divexact!(num, primefactorial(k))