1
0
Fork 0
mirror of synced 2025-09-24 04:40:05 +00:00
ZoKrates/examples/n_choose_k.code

17 lines
367 B
Text

// working with 9988 choose 14
//
def fac(x):
f = 1
counter = 0
for i in 1..20000 do
f = if counter == x then f else f * i fi
counter = if counter == x then counter else counter + 1 fi
endfor
return f
def main(n, k):
top = fac(n)
bot1 = fac(k)
sub = n - k
bot2 = fac(sub)
bot = bot1 * bot2
return top / bot