{"abstract":"Value 131071 produces 17 narrow bars that exceed the symbol definition.","category":"Barcode symbology encoding","checks":8,"contract":"Encode an integer 3..131070 as a one-track Pharmacode: repeatedly, an even value adds a wide bar and becomes (n - 2) / 2, an odd value adds a narrow bar and becomes (n - 1) / 2, until zero; bars are read in the reverse order of generation (left to right). Width: narrow 1, wide 3, spaces 2 between bars. Return [pattern, width] or None outside the range.","evaluation_group":"w2-barcode-symbology-encoding-pharmacode-bars","failed_approach":"A 16-bit bound rejects valid values between 65536 and 131070.","family":"w2-barcode-symbology-encoding-pharmacode-bars-upper-bound","id":"FA-79821","implementations":{"attempt":{"sha256":"44266b55b1dd990874c64f5e1425e3b0740ed49d89e99dfbf808d832b0f5a6fd","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(n):\n    if not isinstance(n, int) or n < 3 or n > 65535:\n        return None\n    bars = []\n    while n > 0:\n        if n % 2 == 0:\n            bars.append('w')\n            n = (n - 2) // 2\n        else:\n            bars.append('n')\n            n = (n - 1) // 2\n    bars.reverse()\n    width = sum(3 if b == 'w' else 1 for b in bars) + 2 * (len(bars) - 1)\n    return [''.join(bars), width]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[131071, None], [88037, ['nwnwnwwwwwwnnwwn', 66]], [34, ['nnnww', 17]], [306, ['nnwwnnww', 30]], [371, ['nwwwnwnn', 30]], [120, ['wwwnnw', 24]], [98, ['wnnnww', 22]], [124778, ['wwwnnwwwnwwnwnww', 68]]], [[131071, None], [96385, ['nwwwwnnnwnnnnnwn', 58]], [6, ['ww', 8]], [85, ['nwnwwn', 22]], [155, ['nnwwwnn', 25]], [306, ['nnwwnnww', 30]], [201, ['wnnwnwn', 25]], [106660, ['wnwnnnnnwnwnnwnw', 58]]], [[131071, None], [93303, ['nwwnwwnnnwwwwnnn', 62]], [142, ['nnnwwww', 27]], [335, ['nwnwnnnn', 26]], [232, ['wwnwnnw', 27]], [397, ['wnnnwwwn', 30]], [147, ['nnwnwnn', 23]], [130692, ['wwwwwwwnwnnnnwnw', 66]]], [[131071, None], [80722, ['nnwwwnwwnwnwnnww', 64]], [229, ['wwnnwwn', 27]], [157, ['nnwwwwn', 27]], [19, ['nwnn', 12]], [27, ['wwnn', 14]], [36, ['nnwnw', 17]], [72515, ['nnnwwnwwnwnnnwnn', 58]]], [[131071, None], [98004, ['nwwwwwwnwwnwnwnw', 68]], [157, ['nnwwwwn', 27]], [228, ['wwnnwnw', 27]], [361, ['nwwnwnwn', 30]], [153, ['nnwwnwn', 25]], [326, ['nwnnnwww', 30]], [84211, ['nwnnwnnnwwwwnwnn', 60]]]]\nlabels = [\"regression: maximum encodable value\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], 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":"7f7795525e68ac935e084db8cd62c93fffad4ebcbcc4c4c72caccd271d38e55c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(n):\n    if not isinstance(n, int) or n < 3 or n > 131071:\n        return None\n    bars = []\n    while n > 0:\n        if n % 2 == 0:\n            bars.append('w')\n            n = (n - 2) // 2\n        else:\n            bars.append('n')\n            n = (n - 1) // 2\n    bars.reverse()\n    width = sum(3 if b == 'w' else 1 for b in bars) + 2 * (len(bars) - 1)\n    return [''.join(bars), width]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[131071, None], [88037, ['nwnwnwwwwwwnnwwn', 66]], [34, ['nnnww', 17]], [306, ['nnwwnnww', 30]], [371, ['nwwwnwnn', 30]], [120, ['wwwnnw', 24]], [98, ['wnnnww', 22]], [124778, ['wwwnnwwwnwwnwnww', 68]]], [[131071, None], [96385, ['nwwwwnnnwnnnnnwn', 58]], [6, ['ww', 8]], [85, ['nwnwwn', 22]], [155, ['nnwwwnn', 25]], [306, ['nnwwnnww', 30]], [201, ['wnnwnwn', 25]], [106660, ['wnwnnnnnwnwnnwnw', 58]]], [[131071, None], [93303, ['nwwnwwnnnwwwwnnn', 62]], [142, ['nnnwwww', 27]], [335, ['nwnwnnnn', 26]], [232, ['wwnwnnw', 27]], [397, ['wnnnwwwn', 30]], [147, ['nnwnwnn', 23]], [130692, ['wwwwwwwnwnnnnwnw', 66]]], [[131071, None], [80722, ['nnwwwnwwnwnwnnww', 64]], [229, ['wwnnwwn', 27]], [157, ['nnwwwwn', 27]], [19, ['nwnn', 12]], [27, ['wwnn', 14]], [36, ['nnwnw', 17]], [72515, ['nnnwwnwwnwnnnwnn', 58]]], [[131071, None], [98004, ['nwwwwwwnwwnwnwnw', 68]], [157, ['nnwwwwn', 27]], [228, ['wwnnwnw', 27]], [361, ['nwwnwnwn', 30]], [153, ['nnwwnwn', 25]], [326, ['nwnnnwww', 30]], [84211, ['nwnnwnnnwwwwnwnn', 60]]]]\nlabels = [\"regression: maximum encodable value\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], 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":"c2845ba3caffaff739487b331b065a3b160b8087c0475cadef5d260a4e0e115f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(n):\n    if not isinstance(n, int) or n < 3 or n > 131070:\n        return None\n    bars = []\n    while n > 0:\n        if n % 2 == 0:\n            bars.append('w')\n            n = (n - 2) // 2\n        else:\n            bars.append('n')\n            n = (n - 1) // 2\n    bars.reverse()\n    width = sum(3 if b == 'w' else 1 for b in bars) + 2 * (len(bars) - 1)\n    return [''.join(bars), width]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[131071, None], [88037, ['nwnwnwwwwwwnnwwn', 66]], [34, ['nnnww', 17]], [306, ['nnwwnnww', 30]], [371, ['nwwwnwnn', 30]], [120, ['wwwnnw', 24]], [98, ['wnnnww', 22]], [124778, ['wwwnnwwwnwwnwnww', 68]]], [[131071, None], [96385, ['nwwwwnnnwnnnnnwn', 58]], [6, ['ww', 8]], [85, ['nwnwwn', 22]], [155, ['nnwwwnn', 25]], [306, ['nnwwnnww', 30]], [201, ['wnnwnwn', 25]], [106660, ['wnwnnnnnwnwnnwnw', 58]]], [[131071, None], [93303, ['nwwnwwnnnwwwwnnn', 62]], [142, ['nnnwwww', 27]], [335, ['nwnwnnnn', 26]], [232, ['wwnwnnw', 27]], [397, ['wnnnwwwn', 30]], [147, ['nnwnwnn', 23]], [130692, ['wwwwwwwnwnnnnwnw', 66]]], [[131071, None], [80722, ['nnwwwnwwnwnwnnww', 64]], [229, ['wwnnwwn', 27]], [157, ['nnwwwwn', 27]], [19, ['nwnn', 12]], [27, ['wwnn', 14]], [36, ['nnwnw', 17]], [72515, ['nnnwwnwwnwnnnwnn', 58]]], [[131071, None], [98004, ['nwwwwwwnwwnwnwnw', 68]], [157, ['nnwwwwn', 27]], [228, ['wwnnwnw', 27]], [361, ['nwwnwnwn', 30]], [153, ['nnwwnwn', 25]], [326, ['nwnnnwww', 30]], [84211, ['nwnnwnnnwwwwnwnn', 60]]]]\nlabels = [\"regression: maximum encodable value\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], 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 with a stipulated contract; it makes no claim of conformance to any published specification. 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":"w2-barcode-symbology-encoding-pharmacode-bars-upper-bound","generated_at":"2026-09-29T14:49:48.202191+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Retail, logistics, pharmacy and document workflows depend on encoders that produce exactly the module pattern, code-set switches, separators and quiet zones scanners expect; one misplaced module or separator makes a label unreadable or, worse, scan as different data.","repair":"Accept values up to 131070.","root_cause":"The upper bound allows 131071.","sha256":"8e55dcaec4a12f71d9ff62b7f7e1bd6d85191fae675304ca78a633229d7c957f","title":"Pharmacode accepts a seventeen-bar value · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":38.021,"exit_code":1,"observations":[{"actual":null,"check":"regression: maximum encodable value 0","expected":null,"passed":true},{"actual":null,"check":"repair trap 1","expected":["nwnwnwwwwwwnnwwn",66],"passed":false},{"actual":["nnnww",17],"check":"combined fault 2","expected":["nnnww",17],"passed":true},{"actual":["nnwwnnww",30],"check":"control 3","expected":["nnwwnnww",30],"passed":true},{"actual":["nwwwnwnn",30],"check":"control 4","expected":["nwwwnwnn",30],"passed":true},{"actual":["wwwnnw",24],"check":"boundary 5","expected":["wwwnnw",24],"passed":true},{"actual":["wnnnww",22],"check":"boundary 6","expected":["wnnnww",22],"passed":true},{"actual":null,"check":"control 7","expected":["wwwnnwwwnwwnwnww",68],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: maximum encodable value 0\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": null, \"expected\": [\"nwnwnwwwwwwnnwwn\", 66], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": [\"nnnww\", 17], \"expected\": [\"nnnww\", 17], \"passed\": true}, {\"check\": \"control 3\", \"actual\": [\"nnwwnnww\", 30], \"expected\": [\"nnwwnnww\", 30], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [\"nwwwnwnn\", 30], \"expected\": [\"nwwwnwnn\", 30], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [\"wwwnnw\", 24], \"expected\": [\"wwwnnw\", 24], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [\"wnnnww\", 22], \"expected\": [\"wnnnww\", 22], \"passed\": true}, {\"check\": \"control 7\", \"actual\": null, \"expected\": [\"wwwnnwwwnwwnwnww\", 68], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.219,"exit_code":1,"observations":[{"actual":["nnnnnnnnnnnnnnnnn",49],"check":"regression: maximum encodable value 0","expected":null,"passed":false},{"actual":["nwnwnwwwwwwnnwwn",66],"check":"repair trap 1","expected":["nwnwnwwwwwwnnwwn",66],"passed":true},{"actual":["nnnww",17],"check":"combined fault 2","expected":["nnnww",17],"passed":true},{"actual":["nnwwnnww",30],"check":"control 3","expected":["nnwwnnww",30],"passed":true},{"actual":["nwwwnwnn",30],"check":"control 4","expected":["nwwwnwnn",30],"passed":true},{"actual":["wwwnnw",24],"check":"boundary 5","expected":["wwwnnw",24],"passed":true},{"actual":["wnnnww",22],"check":"boundary 6","expected":["wnnnww",22],"passed":true},{"actual":["wwwnnwwwnwwnwnww",68],"check":"control 7","expected":["wwwnnwwwnwwnwnww",68],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: maximum encodable value 0\", \"actual\": [\"nnnnnnnnnnnnnnnnn\", 49], \"expected\": null, \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [\"nwnwnwwwwwwnnwwn\", 66], \"expected\": [\"nwnwnwwwwwwnnwwn\", 66], \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": [\"nnnww\", 17], \"expected\": [\"nnnww\", 17], \"passed\": true}, {\"check\": \"control 3\", \"actual\": [\"nnwwnnww\", 30], \"expected\": [\"nnwwnnww\", 30], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [\"nwwwnwnn\", 30], \"expected\": [\"nwwwnwnn\", 30], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [\"wwwnnw\", 24], \"expected\": [\"wwwnnw\", 24], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [\"wnnnww\", 22], \"expected\": [\"wnnnww\", 22], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [\"wwwnnwwwnwwnwnww\", 68], \"expected\": [\"wwwnnwwwnwwnwnww\", 68], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":40.411,"exit_code":0,"observations":[{"actual":null,"check":"regression: maximum encodable value 0","expected":null,"passed":true},{"actual":["nwnwnwwwwwwnnwwn",66],"check":"repair trap 1","expected":["nwnwnwwwwwwnnwwn",66],"passed":true},{"actual":["nnnww",17],"check":"combined fault 2","expected":["nnnww",17],"passed":true},{"actual":["nnwwnnww",30],"check":"control 3","expected":["nnwwnnww",30],"passed":true},{"actual":["nwwwnwnn",30],"check":"control 4","expected":["nwwwnwnn",30],"passed":true},{"actual":["wwwnnw",24],"check":"boundary 5","expected":["wwwnnw",24],"passed":true},{"actual":["wnnnww",22],"check":"boundary 6","expected":["wnnnww",22],"passed":true},{"actual":["wwwnnwwwnwwnwnww",68],"check":"control 7","expected":["wwwnnwwwnwwnwnww",68],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: maximum encodable value 0\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": [\"nwnwnwwwwwwnnwwn\", 66], \"expected\": [\"nwnwnwwwwwwnnwwn\", 66], \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": [\"nnnww\", 17], \"expected\": [\"nnnww\", 17], \"passed\": true}, {\"check\": \"control 3\", \"actual\": [\"nnwwnnww\", 30], \"expected\": [\"nnwwnnww\", 30], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [\"nwwwnwnn\", 30], \"expected\": [\"nwwwnwnn\", 30], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [\"wwwnnw\", 24], \"expected\": [\"wwwnnw\", 24], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [\"wnnnww\", 22], \"expected\": [\"wnnnww\", 22], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [\"wwwnnwwwnwwnwnww\", 68], \"expected\": [\"wwwnnwwwnwwnwnww\", 68], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}