I am writing a simulation that includes the variables n and k. These variable serves a part in numerous "n choose k" calculations. Since these caluclations are often identical in my simulation, and since n and k can be large (sometimes n > 20), I want to implement a scheme whereby the "n choose k" calculations are pre-computed and stored for lookup.
More specifically, k is not constant throughout my simulation. Within a simulation it can, for example, change from 5 to 4, to 6, to another number. Now, I want to avoid adding IF conditions for every value if n and k but I am unsure about the best-practice for creating a look-up scheme in my situation. To be sure, what must be looked-up are the "n choose k" matrixes, and not simply the binomial coefficients.
How might the described scheme be implemented?