FAILURE MAP
← Case archive

FA-5626 / Combinatorics / Open access

Prime length necklace colorings · case 01

Dividing all words by the length mishandles constant words with smaller rotation orbits.

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

ROOT CAUSE

Dividing all words by the length mishandles constant words with smaller rotation orbits.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return (colors**length+(length-1)*colors)//length

Unsuccessful approach: Rotationally equivalent colorings are counted separately.

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. length is prime and colors>=1; count colorings of a labelled-position cycle up to rotations, retaining reflection distinctions. Exact operational definition: (colors**length+(length-1)*colors)//length

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(length, colors):
    return colors**length//length
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3, 2)', solve(*(3, 2)), 4)
check('fixture 2: (5, 2)', solve(*(5, 2)), 8)
check('fixture 3: (2, 3)', solve(*(2, 3)), 6)
check('fixture 4: (3, 1)', solve(*(3, 1)), 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: (3, 2)24Failed
fixture 2: (5, 2)68Failed
fixture 3: (2, 3)46Failed
fixture 4: (3, 1)01Failed

SHA-256 / 919cf139f81d820ecb217792c5f2560cb81782f581051d15f77b7b51bef591a3

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(length, colors):
    return colors**length
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3, 2)', solve(*(3, 2)), 4)
check('fixture 2: (5, 2)', solve(*(5, 2)), 8)
check('fixture 3: (2, 3)', solve(*(2, 3)), 6)
check('fixture 4: (3, 1)', solve(*(3, 1)), 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: (3, 2)84Failed
fixture 2: (5, 2)328Failed
fixture 3: (2, 3)96Failed
fixture 4: (3, 1)11Passed

SHA-256 / 822e3ef8d431bcb2e2e665d1f900b4a5fe5dd32003dd6b59309b8be5a656345a

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(length, colors):
    return (colors**length+(length-1)*colors)//length
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3, 2)', solve(*(3, 2)), 4)
check('fixture 2: (5, 2)', solve(*(5, 2)), 8)
check('fixture 3: (2, 3)', solve(*(2, 3)), 6)
check('fixture 4: (3, 1)', solve(*(3, 1)), 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: (3, 2)44Passed
fixture 2: (5, 2)88Passed
fixture 3: (2, 3)66Passed
fixture 4: (3, 1)11Passed

SHA-256 / e4438b6ff9841ed4b6e237f5741db96f036fa670ded63f35243ef01a71f4ef1a

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

Case digest / 42bfd64065ec920f07ca300c37bef99a83462090e045c2c941fbf470357d472e