FAILURE MAP
← Case archive

FA-5741 / Combinatorics / Open access

Cumulative binomial count · case 01

An exact-cardinality count replaces a cumulative count.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

An exact-cardinality count replaces a cumulative count.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return sum(math.comb(n,i) for i in range(min(n,k)+1))

Unsuccessful approach: The allowed maximum cardinality is excluded.

Case contract

Nonnegative integer counts. Permutation and combination counts are zero when a requested selection exceeds the available objects. Shape sizes satisfy the preconditions stated below. Cumulative binomial count. Exact operational definition: sum(math.comb(n,i) for i in range(min(n,k)+1))

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Combinatorics results depend on the stated convention.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(n, k):
    return math.comb(n,k)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 2)', solve(*(4, 2)), 11)
check('fixture 2: (3, 0)', solve(*(3, 0)), 1)
check('fixture 3: (2, 5)', solve(*(2, 5)), 4)
check('fixture 4: (0, 0)', solve(*(0, 0)), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 1: (4, 2)611Failed
fixture 2: (3, 0)11Passed
fixture 3: (2, 5)04Failed
fixture 4: (0, 0)11Passed

SHA-256 / 49f4655c63edaa5864f7dd82270bf8675136e1293f17d18f4e4892008b87d3fd

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(n, k):
    return sum(math.comb(n,i) for i in range(min(n,k)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 2)', solve(*(4, 2)), 11)
check('fixture 2: (3, 0)', solve(*(3, 0)), 1)
check('fixture 3: (2, 5)', solve(*(2, 5)), 4)
check('fixture 4: (0, 0)', solve(*(0, 0)), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 1: (4, 2)511Failed
fixture 2: (3, 0)01Failed
fixture 3: (2, 5)34Failed
fixture 4: (0, 0)01Failed

SHA-256 / 1553e3b72de69fb02d9b866b1e079f83677aa0ad2e1a298c54624cf2e19c1022

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(n, k):
    return sum(math.comb(n,i) for i in range(min(n,k)+1))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 2)', solve(*(4, 2)), 11)
check('fixture 2: (3, 0)', solve(*(3, 0)), 1)
check('fixture 3: (2, 5)', solve(*(2, 5)), 4)
check('fixture 4: (0, 0)', solve(*(0, 0)), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 1: (4, 2)1111Passed
fixture 2: (3, 0)11Passed
fixture 3: (2, 5)44Passed
fixture 4: (0, 0)11Passed

SHA-256 / e6cd62a55b8b0f37d498466248af9202362f91cd6b286150ba69144b4866ad92

Verification & scope

This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:37:53.093521+00:00.

Case digest / 14c3a984673986d17b2f8c743473d3e54ba36ce8d574795adbde3961c874da97