me@localhost:~> bc d=1; for(i=21; i I couldn't start Python for some reason, so I went 1337 and used BC, which comes preinstalled in every Unix-like OS. BC has a surprising advantage here since 40!/20! cannot be represented as a 64-bit integer since its value exceeds 2^64. That said, BC's stdlib does not provide the factorial function* - so I had to resort to using for-loops instead. * - What it does contain is sine,…
let ans = 1
for (let i=1; i
The same idea can be trivially tweaked to compute any binomial coefficient without ever storing an integer greater than the final result.