FAILURE MAP
← Case archive

FA-5591 / Combinatorics / Open access

Ordered samples without replacement · case 01

Unordered selection drops permutation multiplicity.

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

ROOT CAUSE

Unordered selection drops permutation multiplicity.

VERIFIED REPAIR

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

Unsuccessful approach: Allowing replacement repeats objects that must be distinct.

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. Ordered samples without replacement. Exact operational definition: math.perm(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.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)), 20)
check('fixture 2: (3, 0)', solve(*(3, 0)), 1)
check('fixture 3: (3, 3)', solve(*(3, 3)), 6)
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)1020Failed
fixture 2: (3, 0)11Passed
fixture 3: (3, 3)16Failed
fixture 4: (2, 3)00Passed

SHA-256 / 82f5c5427696e83e91a5d69e6c4c09766a7dc975509f10a1e21f5e4c895bae73

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 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)), 20)
check('fixture 2: (3, 0)', solve(*(3, 0)), 1)
check('fixture 3: (3, 3)', solve(*(3, 3)), 6)
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)2520Failed
fixture 2: (3, 0)11Passed
fixture 3: (3, 3)276Failed
fixture 4: (2, 3)80Failed

SHA-256 / 34c97a84b50825f96ec731018764babb776f6a38bbf3dfc9ca396b99a1188cad

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.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)), 20)
check('fixture 2: (3, 0)', solve(*(3, 0)), 1)
check('fixture 3: (3, 3)', solve(*(3, 3)), 6)
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)2020Passed
fixture 2: (3, 0)11Passed
fixture 3: (3, 3)66Passed
fixture 4: (2, 3)00Passed

SHA-256 / fa31c382755a2a8a130ab041516f480773b0a582bbab38383c6079bbec0cabe4

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

Case digest / 559ce313e6da1aee4d14c3782ded84391d8c1b8d6ef28358689623b42444864b