import "utils/casts/u32_to_field" as to_field;

// Binomial Coeffizient, n!/(k!*(n-k)!).
def fac(field x) -> field {
    field mut f = 1;
    field mut counter = 0;
    for u32 i in 1..100 {
        f = counter == x ? f : f * to_field(i);
        counter = counter == x ? counter : counter + 1;
    }
    return f;
}

def main(field n, field k) -> field {
    return fac(n) / (fac(k) * fac(n - k));
}
