FAILURE MAP
← Case archive

FA-5576 / Number theory / Open access

Decimal digit count · case 01

The minus sign is counted as a decimal digit.

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

ROOT CAUSE

The minus sign is counted as a decimal digit.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return len(str(abs(n)))

Unsuccessful approach: Binary width does not count decimal digits.

Case contract

Integer inputs; n is positive unless a zero or negative fixture explicitly extends that operation. A modulus is greater than one; p is prime; exponent k may be signed when an inverse exists. n is any signed integer; count magnitude decimal digits, with one digit for zero. Exact operational definition: len(str(abs(n)))

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Number theory 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):
    return len(str(n))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0,)', solve(*(0,)), 1)
check('fixture 2: (-100,)', solve(*(-100,)), 3)
check('fixture 3: (9,)', solve(*(9,)), 1)
check('fixture 4: (1000,)', solve(*(1000,)), 4)
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: (0,)11Passed
fixture 2: (-100,)43Failed
fixture 3: (9,)11Passed
fixture 4: (1000,)44Passed

SHA-256 / 821cee881dcaae7a4f1af15dfd34ab8e9bf0af631355ae9a2d296399cc306a6e

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):
    return abs(n).bit_length()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0,)', solve(*(0,)), 1)
check('fixture 2: (-100,)', solve(*(-100,)), 3)
check('fixture 3: (9,)', solve(*(9,)), 1)
check('fixture 4: (1000,)', solve(*(1000,)), 4)
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: (0,)01Failed
fixture 2: (-100,)73Failed
fixture 3: (9,)41Failed
fixture 4: (1000,)104Failed

SHA-256 / bc61b695807275f4982b8ffb8b5bb779abe46e7741e686addd964889a1748ff8

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):
    return len(str(abs(n)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0,)', solve(*(0,)), 1)
check('fixture 2: (-100,)', solve(*(-100,)), 3)
check('fixture 3: (9,)', solve(*(9,)), 1)
check('fixture 4: (1000,)', solve(*(1000,)), 4)
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: (0,)11Passed
fixture 2: (-100,)33Passed
fixture 3: (9,)11Passed
fixture 4: (1000,)44Passed

SHA-256 / 2ce7a28685830cc1ad904d11cc3e603b9f13e4c116344109c88637a409cbe6ad

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

Case digest / e5917a9639bc791bd13dedf9e6b1b6daecb8676928113b00454ec774a9410eea