Binomial coefficient

前端 未结 4 1446
深忆病人
深忆病人 2020-12-11 21:23

\'Simple\' question, what is the fastest way to calculate the binomial coefficient? - Some threaded algorithm?

I\'m looking for hints :) - not implementations :)

4条回答
  •  被撕碎了的回忆
    2020-12-11 21:36

    Well the fastest way, I reckon, would be to read them from a table rather than compute them.

    Your requirements on integer accuracy from using a double representation means that C(60,30) is all but too big, being around 1e17, so that (assuming you want to have C(m,n) for all m up to some limit, and all n<=m), your table would only have around 1800 entries. As for filling the table in I think Pascal's triangle is the way to go.

提交回复
热议问题