FAILURE MAP
← Case archive

FA-5596 / Combinatorics / Open access

Unordered samples without replacement · case 01

Ordered arrangements overcount each selected subset.

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

ROOT CAUSE

Ordered arrangements overcount each selected subset.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return math.comb(n,k)

Unsuccessful approach: The multiset coefficient permits repeated selections.

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. Unordered samples without replacement. Exact operational definition: math.comb(n,k)

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.perm(n,k)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (5, 2)', solve(*(5, 2)), 10)
check('fixture 2: (3, 0)', solve(*(3, 0)), 1)
check('fixture 3: (3, 3)', solve(*(3, 3)), 1)
check('fixture 4: (2, 3)', solve(*(2, 3)), 0)
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: (5, 2)2010Failed
fixture 2: (3, 0)11Passed
fixture 3: (3, 3)61Failed
fixture 4: (2, 3)00Passed

SHA-256 / f4912516abf93a03f8b748529bbe0cef4dbb3c1578d5853b2383eed5833fb377

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 math.comb(n+k-1,k)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (5, 2)', solve(*(5, 2)), 10)
check('fixture 2: (3, 0)', solve(*(3, 0)), 1)
check('fixture 3: (3, 3)', solve(*(3, 3)), 1)
check('fixture 4: (2, 3)', solve(*(2, 3)), 0)
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: (5, 2)1510Failed
fixture 2: (3, 0)11Passed
fixture 3: (3, 3)101Failed
fixture 4: (2, 3)40Failed

SHA-256 / 14e6cf4e7c19d65d7bc36ba87dbc2bdd231dacd8550b9e07af1a680835814fad

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 math.comb(n,k)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (5, 2)', solve(*(5, 2)), 10)
check('fixture 2: (3, 0)', solve(*(3, 0)), 1)
check('fixture 3: (3, 3)', solve(*(3, 3)), 1)
check('fixture 4: (2, 3)', solve(*(2, 3)), 0)
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: (5, 2)1010Passed
fixture 2: (3, 0)11Passed
fixture 3: (3, 3)11Passed
fixture 4: (2, 3)00Passed

SHA-256 / 02fcb7d6354aa7c9200a3979343476c271efa4fa23c22ba26f438dd11bb2f8cb

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:51.172721+00:00.

Case digest / fb7e7142ddd958ea66b5f08c37c586c54dab8eb554b3ee055aaa655a57784c6e