I need a way of calculating combinations without running out of memory. Here\'s what i have so far.
public static long combination(long n, long k) // nCk {
Just for the sake of completion: the standard C math library has implementations of both Γ and lnΓ (called tgamma and lgamma), where
C
tgamma
lgamma
Γ(n) = (n-1)!
The library computation is certainly faster and more accurate than summing logarithms. For a lot more information, see Wikipedia and Mathworld.