FA-5356 / Integer arithmetic / Open access
Integer square ceiling · case 01
The lower root is used when an enclosing square is required.
ROOT CAUSE
The lower root is used when an enclosing square is required.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return math.isqrt(n) + (math.isqrt(n)**2 < n)
Unsuccessful approach: Always adding one overshoots perfect squares.
Case contract
Integer arguments; denominators, steps, moduli, and bit widths are positive. Unsigned word inputs fit the specified width except where masking is explicitly the operation. Sequence sizes are nonnegative. n is nonnegative. Return the least r>=0 such that r*r>=n. Exact operational definition: math.isqrt(n) + (math.isqrt(n)**2 < n)
Why this case matters
Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Integer mathematics 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 math.isqrt(n)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0,)', solve(*(0,)), 0)
check('fixture 2: (1,)', solve(*(1,)), 1)
check('fixture 3: (2,)', solve(*(2,)), 2)
check('fixture 4: (16,)', solve(*(16,)), 4)
check('fixture 5: (17,)', solve(*(17,)), 5)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: (0,) | 0 | 0 | Passed |
| fixture 2: (1,) | 1 | 1 | Passed |
| fixture 3: (2,) | 1 | 2 | Failed |
| fixture 4: (16,) | 4 | 4 | Passed |
| fixture 5: (17,) | 4 | 5 | Failed |
SHA-256 / e24b7c61ebfa314e216aaa1d818d20ae2b24427fd2179a4fa1ef800e2ff299f6
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 math.isqrt(n)+1
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0,)', solve(*(0,)), 0)
check('fixture 2: (1,)', solve(*(1,)), 1)
check('fixture 3: (2,)', solve(*(2,)), 2)
check('fixture 4: (16,)', solve(*(16,)), 4)
check('fixture 5: (17,)', solve(*(17,)), 5)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: (0,) | 1 | 0 | Failed |
| fixture 2: (1,) | 2 | 1 | Failed |
| fixture 3: (2,) | 2 | 2 | Passed |
| fixture 4: (16,) | 5 | 4 | Failed |
| fixture 5: (17,) | 5 | 5 | Passed |
SHA-256 / c534e95939ef57cdfa9eda533bdb8ef1a286351c88e7c17419ccc396c2e19157
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 math.isqrt(n) + (math.isqrt(n)**2 < n)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0,)', solve(*(0,)), 0)
check('fixture 2: (1,)', solve(*(1,)), 1)
check('fixture 3: (2,)', solve(*(2,)), 2)
check('fixture 4: (16,)', solve(*(16,)), 4)
check('fixture 5: (17,)', solve(*(17,)), 5)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: (0,) | 0 | 0 | Passed |
| fixture 2: (1,) | 1 | 1 | Passed |
| fixture 3: (2,) | 2 | 2 | Passed |
| fixture 4: (16,) | 4 | 4 | Passed |
| fixture 5: (17,) | 5 | 5 | Passed |
SHA-256 / 7fdd5226dd6d121d266da05e92f360c432f8dd93c4e67fd2c855f7d83b7e24a4
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:48.590945+00:00.
Case digest / 8dea4d642af6a4001db04fd71aa3dcd66b8e10e7d1f13e385e9f6ca55350be58