FAILURE MAP
← Case archive

FA-81956 / Poker hand evaluation / Open access

Composite prime table entry fakes a pair · case 01

Any hand holding an ace and a trey or a seven is reported as containing a pair.

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

ROOT CAUSE

The ace entry of the prime table is 39 = 3 x 13, so an ace factors into the trey prime and the seven prime.

VERIFIED REPAIR

Use a table of thirteen distinct primes; the ace is 41.

Unsuccessful approach: Replacing 39 with 49 is still composite (7 x 7) and turns every ace into a pair of sevens.

Case contract

Input: five cards "Rs" (rank may be written "10" for ten; suits ignored, repeated ranks allowed up to four). Each rank maps to a distinct prime (2 for deuce ... 41 for ace); the product of the five primes is factored back into rank multiplicities, and the sorted multiplicity pattern names the rank shape: four of a kind, full house, three of a kind, two pair, one pair or high card.

Why this case matters

Prime-product hashing is how table-driven evaluators identify non-flush rank multisets.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    R='23456789TJQKA'
    P=[2,3,5,7,11,13,17,19,23,29,31,37,39]
    prod=1
    for c in x:
        prod*=P[R.index('T' if c[:-1]=='10' else c[:-1])]
    exps=[]
    for p in P:
        e=0
        while prod%p==0:
            prod//=p
            e+=1
        if e: exps.append(e)
    exps.sort(reverse=True)
    names={(4,1):'four of a kind',(3,2):'full house',(3,1,1):'three of a kind',(2,2,1):'two pair',(2,1,1,1):'one pair',(1,1,1,1,1):'high card'}
    return names[tuple(exps)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('ace high', ['Ah', 'Kd', '9c', '7s', '4h'], 'high card'),
  ('pair of aces', ['Ah', 'Ad', '9c', '7s', '4h'], 'one pair'),
  ('full house', ['Kh', 'Kd', '2c', '2s', '2h'], 'full house'),
  ('quads', ['9h', '9d', '9c', '9s', '2h'], 'four of a kind'),
  ('trips deuces', ['2h', '2d', '2c', 'Ks', 'Qh'], 'three of a kind'),
  ('high card low', ['2h', '3d', '5c', '7s', '9h'], 'high card'),
  ('pair of deuces', ['2h', '2d', '5c', '7s', '9h'], 'one pair'),
  ('ten token pair', ['10h', 'Td', '8c', '6s', '4h'], 'one pair')],
 [('ace high', ['Ah', 'Kd', '9c', '7s', '4h'], 'high card'),
  ('pair of aces', ['Ah', 'Ad', '9c', '7s', '4h'], 'one pair'),
  ('ace with three', ['Ah', '3d', '9c', '7s', '4h'], 'high card'),
  ('ace with king', ['Ah', 'Kd', 'Qc', '7s', '4h'], 'high card'),
  ('high card low', ['2h', '3d', '5c', '7s', '9h'], 'high card'),
  ('pair of deuces', ['2h', '2d', '5c', '7s', '9h'], 'one pair'),
  ('ten token pair', ['10h', 'Td', '8c', '6s', '4h'], 'one pair'),
  ('ten token full house', ['10h', '10d', 'Tc', '6s', '6h'], 'full house')],
 [('ace high', ['Ah', 'Kd', '9c', '7s', '4h'], 'high card'),
  ('pair of aces', ['Ah', 'Ad', '9c', '7s', '4h'], 'one pair'),
  ('ace with three', ['Ah', '3d', '9c', '7s', '4h'], 'high card'),
  ('ace with king', ['Ah', 'Kd', 'Qc', '7s', '4h'], 'high card'),
  ('ace with seven pair', ['Ah', '7d', '7c', '2s', '4h'], 'one pair'),
  ('two pair', ['Jh', 'Jd', '4c', '4s', 'Ah'], 'two pair'),
  ('deuce and ace', ['2h', 'Ad', '8c', '6s', '4h'], 'high card'),
  ('ten token full house', ['10h', '10d', 'Tc', '6s', '6h'], 'full house')],
 [('ace with three', ['Ah', '3d', '9c', '7s', '4h'], 'high card'),
  ('ace with king', ['Ah', 'Kd', 'Qc', '7s', '4h'], 'high card'),
  ('ace with seven pair', ['Ah', '7d', '7c', '2s', '4h'], 'one pair'),
  ('full house', ['Kh', 'Kd', '2c', '2s', '2h'], 'full house'),
  ('quads', ['9h', '9d', '9c', '9s', '2h'], 'four of a kind'),
  ('two pair', ['Jh', 'Jd', '4c', '4s', 'Ah'], 'two pair'),
  ('deuce and ace', ['2h', 'Ad', '8c', '6s', '4h'], 'high card'),
  ('ten token with ace', ['10h', 'Ad', '8c', '6s', '4h'], 'high card')],
 [('ace with seven pair', ['Ah', '7d', '7c', '2s', '4h'], 'one pair'),
  ('full house', ['Kh', 'Kd', '2c', '2s', '2h'], 'full house'),
  ('quads', ['9h', '9d', '9c', '9s', '2h'], 'four of a kind'),
  ('two pair', ['Jh', 'Jd', '4c', '4s', 'Ah'], 'two pair'),
  ('trips deuces', ['2h', '2d', '2c', 'Ks', 'Qh'], 'three of a kind'),
  ('deuce and ace', ['2h', 'Ad', '8c', '6s', '4h'], 'high card'),
  ('high card low', ['2h', '3d', '5c', '7s', '9h'], 'high card'),
  ('ten token with ace', ['10h', 'Ad', '8c', '6s', '4h'], 'high card')]]
for label, args, expected in fixtures[N-1]:
    try:
        actual = solve(args)
    except Exception as exc:
        actual = 'error:' + type(exc).__name__
    check(label, actual, expected)
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
ace higherror:KeyErrorhigh cardFailed
pair of aceserror:KeyErrorone pairFailed
full housefull housefull housePassed
quadsfour of a kindfour of a kindPassed
trips deucesthree of a kindthree of a kindPassed
high card lowhigh cardhigh cardPassed
pair of deucesone pairone pairPassed
ten token pairone pairone pairPassed

SHA-256 / 309bef81a73e4727af49d7aa47daf6b12671273327b3321c8213bb22446fc24b

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    R='23456789TJQKA'
    P=[2,3,5,7,11,13,17,19,23,29,31,37,49]
    prod=1
    for c in x:
        prod*=P[R.index('T' if c[:-1]=='10' else c[:-1])]
    exps=[]
    for p in P:
        e=0
        while prod%p==0:
            prod//=p
            e+=1
        if e: exps.append(e)
    exps.sort(reverse=True)
    names={(4,1):'four of a kind',(3,2):'full house',(3,1,1):'three of a kind',(2,2,1):'two pair',(2,1,1,1):'one pair',(1,1,1,1,1):'high card'}
    return names[tuple(exps)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('ace high', ['Ah', 'Kd', '9c', '7s', '4h'], 'high card'),
  ('pair of aces', ['Ah', 'Ad', '9c', '7s', '4h'], 'one pair'),
  ('full house', ['Kh', 'Kd', '2c', '2s', '2h'], 'full house'),
  ('quads', ['9h', '9d', '9c', '9s', '2h'], 'four of a kind'),
  ('trips deuces', ['2h', '2d', '2c', 'Ks', 'Qh'], 'three of a kind'),
  ('high card low', ['2h', '3d', '5c', '7s', '9h'], 'high card'),
  ('pair of deuces', ['2h', '2d', '5c', '7s', '9h'], 'one pair'),
  ('ten token pair', ['10h', 'Td', '8c', '6s', '4h'], 'one pair')],
 [('ace high', ['Ah', 'Kd', '9c', '7s', '4h'], 'high card'),
  ('pair of aces', ['Ah', 'Ad', '9c', '7s', '4h'], 'one pair'),
  ('ace with three', ['Ah', '3d', '9c', '7s', '4h'], 'high card'),
  ('ace with king', ['Ah', 'Kd', 'Qc', '7s', '4h'], 'high card'),
  ('high card low', ['2h', '3d', '5c', '7s', '9h'], 'high card'),
  ('pair of deuces', ['2h', '2d', '5c', '7s', '9h'], 'one pair'),
  ('ten token pair', ['10h', 'Td', '8c', '6s', '4h'], 'one pair'),
  ('ten token full house', ['10h', '10d', 'Tc', '6s', '6h'], 'full house')],
 [('ace high', ['Ah', 'Kd', '9c', '7s', '4h'], 'high card'),
  ('pair of aces', ['Ah', 'Ad', '9c', '7s', '4h'], 'one pair'),
  ('ace with three', ['Ah', '3d', '9c', '7s', '4h'], 'high card'),
  ('ace with king', ['Ah', 'Kd', 'Qc', '7s', '4h'], 'high card'),
  ('ace with seven pair', ['Ah', '7d', '7c', '2s', '4h'], 'one pair'),
  ('two pair', ['Jh', 'Jd', '4c', '4s', 'Ah'], 'two pair'),
  ('deuce and ace', ['2h', 'Ad', '8c', '6s', '4h'], 'high card'),
  ('ten token full house', ['10h', '10d', 'Tc', '6s', '6h'], 'full house')],
 [('ace with three', ['Ah', '3d', '9c', '7s', '4h'], 'high card'),
  ('ace with king', ['Ah', 'Kd', 'Qc', '7s', '4h'], 'high card'),
  ('ace with seven pair', ['Ah', '7d', '7c', '2s', '4h'], 'one pair'),
  ('full house', ['Kh', 'Kd', '2c', '2s', '2h'], 'full house'),
  ('quads', ['9h', '9d', '9c', '9s', '2h'], 'four of a kind'),
  ('two pair', ['Jh', 'Jd', '4c', '4s', 'Ah'], 'two pair'),
  ('deuce and ace', ['2h', 'Ad', '8c', '6s', '4h'], 'high card'),
  ('ten token with ace', ['10h', 'Ad', '8c', '6s', '4h'], 'high card')],
 [('ace with seven pair', ['Ah', '7d', '7c', '2s', '4h'], 'one pair'),
  ('full house', ['Kh', 'Kd', '2c', '2s', '2h'], 'full house'),
  ('quads', ['9h', '9d', '9c', '9s', '2h'], 'four of a kind'),
  ('two pair', ['Jh', 'Jd', '4c', '4s', 'Ah'], 'two pair'),
  ('trips deuces', ['2h', '2d', '2c', 'Ks', 'Qh'], 'three of a kind'),
  ('deuce and ace', ['2h', 'Ad', '8c', '6s', '4h'], 'high card'),
  ('high card low', ['2h', '3d', '5c', '7s', '9h'], 'high card'),
  ('ten token with ace', ['10h', 'Ad', '8c', '6s', '4h'], 'high card')]]
for label, args, expected in fixtures[N-1]:
    try:
        actual = solve(args)
    except Exception as exc:
        actual = 'error:' + type(exc).__name__
    check(label, actual, expected)
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
ace higherror:KeyErrorhigh cardFailed
pair of aceserror:KeyErrorone pairFailed
full housefull housefull housePassed
quadsfour of a kindfour of a kindPassed
trips deucesthree of a kindthree of a kindPassed
high card lowhigh cardhigh cardPassed
pair of deucesone pairone pairPassed
ten token pairone pairone pairPassed

SHA-256 / ec48fa47a33f46654949a9a040d00c98a8e0f1b729c5450e985916cdfbc7ed53

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    R='23456789TJQKA'
    P=[2,3,5,7,11,13,17,19,23,29,31,37,41]
    prod=1
    for c in x:
        prod*=P[R.index('T' if c[:-1]=='10' else c[:-1])]
    exps=[]
    for p in P:
        e=0
        while prod%p==0:
            prod//=p
            e+=1
        if e: exps.append(e)
    exps.sort(reverse=True)
    names={(4,1):'four of a kind',(3,2):'full house',(3,1,1):'three of a kind',(2,2,1):'two pair',(2,1,1,1):'one pair',(1,1,1,1,1):'high card'}
    return names[tuple(exps)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('ace high', ['Ah', 'Kd', '9c', '7s', '4h'], 'high card'),
  ('pair of aces', ['Ah', 'Ad', '9c', '7s', '4h'], 'one pair'),
  ('full house', ['Kh', 'Kd', '2c', '2s', '2h'], 'full house'),
  ('quads', ['9h', '9d', '9c', '9s', '2h'], 'four of a kind'),
  ('trips deuces', ['2h', '2d', '2c', 'Ks', 'Qh'], 'three of a kind'),
  ('high card low', ['2h', '3d', '5c', '7s', '9h'], 'high card'),
  ('pair of deuces', ['2h', '2d', '5c', '7s', '9h'], 'one pair'),
  ('ten token pair', ['10h', 'Td', '8c', '6s', '4h'], 'one pair')],
 [('ace high', ['Ah', 'Kd', '9c', '7s', '4h'], 'high card'),
  ('pair of aces', ['Ah', 'Ad', '9c', '7s', '4h'], 'one pair'),
  ('ace with three', ['Ah', '3d', '9c', '7s', '4h'], 'high card'),
  ('ace with king', ['Ah', 'Kd', 'Qc', '7s', '4h'], 'high card'),
  ('high card low', ['2h', '3d', '5c', '7s', '9h'], 'high card'),
  ('pair of deuces', ['2h', '2d', '5c', '7s', '9h'], 'one pair'),
  ('ten token pair', ['10h', 'Td', '8c', '6s', '4h'], 'one pair'),
  ('ten token full house', ['10h', '10d', 'Tc', '6s', '6h'], 'full house')],
 [('ace high', ['Ah', 'Kd', '9c', '7s', '4h'], 'high card'),
  ('pair of aces', ['Ah', 'Ad', '9c', '7s', '4h'], 'one pair'),
  ('ace with three', ['Ah', '3d', '9c', '7s', '4h'], 'high card'),
  ('ace with king', ['Ah', 'Kd', 'Qc', '7s', '4h'], 'high card'),
  ('ace with seven pair', ['Ah', '7d', '7c', '2s', '4h'], 'one pair'),
  ('two pair', ['Jh', 'Jd', '4c', '4s', 'Ah'], 'two pair'),
  ('deuce and ace', ['2h', 'Ad', '8c', '6s', '4h'], 'high card'),
  ('ten token full house', ['10h', '10d', 'Tc', '6s', '6h'], 'full house')],
 [('ace with three', ['Ah', '3d', '9c', '7s', '4h'], 'high card'),
  ('ace with king', ['Ah', 'Kd', 'Qc', '7s', '4h'], 'high card'),
  ('ace with seven pair', ['Ah', '7d', '7c', '2s', '4h'], 'one pair'),
  ('full house', ['Kh', 'Kd', '2c', '2s', '2h'], 'full house'),
  ('quads', ['9h', '9d', '9c', '9s', '2h'], 'four of a kind'),
  ('two pair', ['Jh', 'Jd', '4c', '4s', 'Ah'], 'two pair'),
  ('deuce and ace', ['2h', 'Ad', '8c', '6s', '4h'], 'high card'),
  ('ten token with ace', ['10h', 'Ad', '8c', '6s', '4h'], 'high card')],
 [('ace with seven pair', ['Ah', '7d', '7c', '2s', '4h'], 'one pair'),
  ('full house', ['Kh', 'Kd', '2c', '2s', '2h'], 'full house'),
  ('quads', ['9h', '9d', '9c', '9s', '2h'], 'four of a kind'),
  ('two pair', ['Jh', 'Jd', '4c', '4s', 'Ah'], 'two pair'),
  ('trips deuces', ['2h', '2d', '2c', 'Ks', 'Qh'], 'three of a kind'),
  ('deuce and ace', ['2h', 'Ad', '8c', '6s', '4h'], 'high card'),
  ('high card low', ['2h', '3d', '5c', '7s', '9h'], 'high card'),
  ('ten token with ace', ['10h', 'Ad', '8c', '6s', '4h'], 'high card')]]
for label, args, expected in fixtures[N-1]:
    try:
        actual = solve(args)
    except Exception as exc:
        actual = 'error:' + type(exc).__name__
    check(label, actual, expected)
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
ace highhigh cardhigh cardPassed
pair of acesone pairone pairPassed
full housefull housefull housePassed
quadsfour of a kindfour of a kindPassed
trips deucesthree of a kindthree of a kindPassed
high card lowhigh cardhigh cardPassed
pair of deucesone pairone pairPassed
ten token pairone pairone pairPassed

SHA-256 / 1a9d6ae9fb02a94bc760c748f321c814a73b20fd0052e132715ce3242785cb9c

Verification & scope

A deterministic toy model with an explicitly stated contract; card strings are rank+suit (for example "As", "Td", "10h"); no claim of conformance to any casino or tournament rulebook. 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:50:07.659032+00:00.

Case digest / 5942fadd1517ce5cc64045755734b80636e34d791febf7d7984e04ece7f83458