Exact binomial coefficients
Choosequill provides a project-based AI conversation for combinatorial code on Windows. Open the source folder, examine the integer recurrence with a compatible model and check the suggested changes against exact reference values.
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 resultConnection
Base URL, credentials and a reachable server.
Project
Check both endpoints, symmetry and a large result, rejecting invalid or Boolean operands before entering the product loop.
Review before applying
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
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 resultKeep numeric requirements attached to the code
Choosequill gives developers a Windows workspace for discussing numerical code with an AI model while keeping the source project in view. Begin with the requirement that makes a result useful: whether it must be exact, what inputs are accepted and how callers should handle rejection. These decisions give the assistant something concrete to work against before it proposes a replacement implementation.
For example, the binomial-coefficient task asks for exact integer results within a stated input range. Bring that function and its callers into the conversation, then ask how an edit preserves endpoint cases and the meaning of invalid input. A concise formula is only part of the review; the surrounding software must also receive the result in the form it expects.
Use reference values and properties such as symmetry to check the proposal in your own project. Include a large result that would expose an accidental floating-point conversion, inspect the changed code and run the relevant tests. Choosequill can connect to supported OpenAI-compatible or Anthropic endpoints, with credentials when required. Select an unrestricted model where your service offers one, bearing in mind that context limits and tools come from the model and server. Your numerical contract remains the standard for accepting the work.
Review questions for exact calculations
What should I state before asking for a numeric rewrite?
Specify accepted types, the valid range, exactness requirements and expected failure behavior. Include the caller that consumes the result. These details help distinguish a valid software change from a mathematically plausible formula with incompatible outputs.
Why include a large reference result?
Small examples may still pass after an unintended conversion to floating point. A known large integer can expose that change. Compare the exact result rather than formatted display text, then inspect how the caller stores or serializes it.
Should Boolean values count as integers?
Make that decision explicit in the input contract. The existing example rejects them. Review proposed type checks carefully and retain a dedicated fixture so a convenient language-level conversion does not silently broaden accepted input.
What can symmetry checks contribute?
They test a relationship across multiple inputs and can reveal mistakes beyond a handful of reference values. Use them alongside known answers and boundary tests; a relationship holding by itself does not prove the whole implementation correct.
Choosequill · Updated 2026-10-25