Connection
Base URL, credentials and a reachable server.
Calculate exact binomial coefficients for integer n from zero to 10000 and integer k from zero to n.
Base URL, credentials and a reachable server.
A model available through the configured endpoint.
Context limits and tool support are determined by the model and server.
def binomial(n, k):
if any(type(v) is not int for v in (n, k)):
raise ValueError("integer.required")
if not 0 <= k <= n <= 10000:
raise ValueError("binomial.range")
k = min(k, n - k)
result = 1
for i in range(1, k + 1):
result = result * (n - k + i) // i
return result