{"abstract":"The exact lucas binomial residue result violates the stated contract at remaining digit termination.","category":"Numerics","checks":8,"contract":"Input [n,k,p], n,k>=0 p prime; return binomial(n,k) modulo p, zero when k>n. Bounds: n,k<2^30.","evaluation_group":"s3-numerics-lucas-binomial-residue","failed_approach":"The partial repair n<p and k<p still violates the remaining digit termination invariant.","family":"s3-numerics-lucas-binomial-residue-remaining-digit-termination","id":"FA-15521","implementations":{"attempt":{"sha256":"37dad6f4f22fd6a7a1bde41cd0631e85d7b19fe695d075fe0abcfd1672eb116d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport itertools\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    n,k,p=x;r=1\n    for _ in range(30):\n     if n<p and k<p:break\n     a,b=n%p,k%p\n     if b>a:return 0\n     r=r*math.comb(a,b)%p\n     n,k=n//p,k//p\n    return r\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([0, 1, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([0, 2, 2], 0), ([0, 3, 2], 0), ([0, 4, 2], 0), ([0, 5, 2], 0), ([0, 6, 2], 0)], [([0, 2, 2], 0), ([0, 8, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([0, 17, 2], 0), ([0, 18, 2], 0), ([0, 19, 2], 0), ([0, 20, 2], 0)], [([0, 3, 2], 0), ([1, 2, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([0, 34, 2], 0), ([0, 35, 2], 0), ([0, 36, 2], 0), ([0, 37, 2], 0)], [([0, 4, 2], 0), ([1, 5, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([1, 13, 2], 0), ([1, 14, 2], 0), ([1, 15, 2], 0), ([1, 16, 2], 0)], [([0, 5, 2], 0), ([1, 16, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([1, 30, 2], 0), ([1, 31, 2], 0), ([1, 32, 2], 0), ([1, 33, 2], 0)]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"explicit oracle %d\" % i, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"05da410c3a0ab017f9a498e6b8ba375f97ed454d297f81fe9f606d021528e309","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport itertools\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    n,k,p=x;r=1\n    for _ in range(30):\n     if n==0:break\n     a,b=n%p,k%p\n     if b>a:return 0\n     r=r*math.comb(a,b)%p\n     n,k=n//p,k//p\n    return r\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([0, 1, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([0, 2, 2], 0), ([0, 3, 2], 0), ([0, 4, 2], 0), ([0, 5, 2], 0), ([0, 6, 2], 0)], [([0, 2, 2], 0), ([0, 8, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([0, 17, 2], 0), ([0, 18, 2], 0), ([0, 19, 2], 0), ([0, 20, 2], 0)], [([0, 3, 2], 0), ([1, 2, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([0, 34, 2], 0), ([0, 35, 2], 0), ([0, 36, 2], 0), ([0, 37, 2], 0)], [([0, 4, 2], 0), ([1, 5, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([1, 13, 2], 0), ([1, 14, 2], 0), ([1, 15, 2], 0), ([1, 16, 2], 0)], [([0, 5, 2], 0), ([1, 16, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([1, 30, 2], 0), ([1, 31, 2], 0), ([1, 32, 2], 0), ([1, 33, 2], 0)]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"explicit oracle %d\" % i, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"2672ca23eb07b18c1f4e062a8aaf54c677a94167052bc7aad70991f548cad689","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport itertools\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    n,k,p=x;r=1\n    for _ in range(30):\n     if n==0 and k==0:break\n     a,b=n%p,k%p\n     if b>a:return 0\n     r=r*math.comb(a,b)%p\n     n,k=n//p,k//p\n    return r\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([0, 1, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([0, 2, 2], 0), ([0, 3, 2], 0), ([0, 4, 2], 0), ([0, 5, 2], 0), ([0, 6, 2], 0)], [([0, 2, 2], 0), ([0, 8, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([0, 17, 2], 0), ([0, 18, 2], 0), ([0, 19, 2], 0), ([0, 20, 2], 0)], [([0, 3, 2], 0), ([1, 2, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([0, 34, 2], 0), ([0, 35, 2], 0), ([0, 36, 2], 0), ([0, 37, 2], 0)], [([0, 4, 2], 0), ([1, 5, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([1, 13, 2], 0), ([1, 14, 2], 0), ([1, 15, 2], 0), ([1, 16, 2], 0)], [([0, 5, 2], 0), ([1, 16, 2], 0), ([0, 0, 2], 1), ([34, 37, 7], 0), ([1, 30, 2], 0), ([1, 31, 2], 0), ([1, 32, 2], 0), ([1, 33, 2], 0)]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"explicit oracle %d\" % i, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"A deterministic bounded teaching model. Inputs are restricted to the explicit contract; this is not a production algebra library. 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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"s3-numerics-lucas-binomial-residue-remaining-digit-termination","generated_at":"2026-09-29T14:39:27.492031+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Exact discrete arithmetic with observable algorithmic state; no floating point approximation is used.","repair":"Use n==0 and k==0 at the remaining digit termination step.","root_cause":"The remaining digit termination step uses n==0 instead of n==0 and k==0.","sha256":"305b7dd2cf9bae33d5900250548e69c7846bb447a64dce424de69f523384ef94","title":"Lucas binomial residue: remaining digit termination · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.817,"exit_code":1,"observations":[{"actual":1,"check":"explicit oracle 0","expected":0,"passed":false},{"actual":1,"check":"explicit oracle 1","expected":1,"passed":true},{"actual":1,"check":"explicit oracle 2","expected":0,"passed":false},{"actual":1,"check":"explicit oracle 3","expected":0,"passed":false},{"actual":0,"check":"explicit oracle 4","expected":0,"passed":true},{"actual":1,"check":"explicit oracle 5","expected":0,"passed":false},{"actual":0,"check":"explicit oracle 6","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 7","expected":0,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"explicit oracle 0\", \"actual\": 1, \"expected\": 0, \"passed\": false}, {\"check\": \"explicit oracle 1\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"explicit oracle 2\", \"actual\": 1, \"expected\": 0, \"passed\": false}, {\"check\": \"explicit oracle 3\", \"actual\": 1, \"expected\": 0, \"passed\": false}, {\"check\": \"explicit oracle 4\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 5\", \"actual\": 1, \"expected\": 0, \"passed\": false}, {\"check\": \"explicit oracle 6\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 7\", \"actual\": 0, \"expected\": 0, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.47,"exit_code":1,"observations":[{"actual":1,"check":"explicit oracle 0","expected":0,"passed":false},{"actual":1,"check":"explicit oracle 1","expected":1,"passed":true},{"actual":0,"check":"explicit oracle 2","expected":0,"passed":true},{"actual":1,"check":"explicit oracle 3","expected":0,"passed":false},{"actual":1,"check":"explicit oracle 4","expected":0,"passed":false},{"actual":1,"check":"explicit oracle 5","expected":0,"passed":false},{"actual":1,"check":"explicit oracle 6","expected":0,"passed":false},{"actual":1,"check":"explicit oracle 7","expected":0,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"explicit oracle 0\", \"actual\": 1, \"expected\": 0, \"passed\": false}, {\"check\": \"explicit oracle 1\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"explicit oracle 2\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 3\", \"actual\": 1, \"expected\": 0, \"passed\": false}, {\"check\": \"explicit oracle 4\", \"actual\": 1, \"expected\": 0, \"passed\": false}, {\"check\": \"explicit oracle 5\", \"actual\": 1, \"expected\": 0, \"passed\": false}, {\"check\": \"explicit oracle 6\", \"actual\": 1, \"expected\": 0, \"passed\": false}, {\"check\": \"explicit oracle 7\", \"actual\": 1, \"expected\": 0, \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":44.019,"exit_code":0,"observations":[{"actual":0,"check":"explicit oracle 0","expected":0,"passed":true},{"actual":1,"check":"explicit oracle 1","expected":1,"passed":true},{"actual":0,"check":"explicit oracle 2","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 3","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 4","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 5","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 6","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 7","expected":0,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"explicit oracle 0\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 1\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"explicit oracle 2\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 3\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 4\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 5\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 6\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 7\", \"actual\": 0, \"expected\": 0, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}