FA-5451 / Integer arithmetic / Open access
Sum first squares · case 01
The sum of terms is used instead of the sum of their squares.
ROOT CAUSE
The sum of terms is used instead of the sum of their squares.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return n*(n+1)*(2*n+1)//6
Unsuccessful approach: The square-sum normalization is off by a factor of two.
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. Return sum(i*i for i from 1 through n), with n nonnegative. Exact operational definition: n*(n+1)*(2*n+1)//6
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 n*(n+1)//2
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: (3,)', solve(*(3,)), 14)
check('fixture 4: (5,)', solve(*(5,)), 55)
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: (3,) | 6 | 14 | Failed |
| fixture 4: (5,) | 15 | 55 | Failed |
SHA-256 / e6c3c4c006071bc55849ae385cbbc40c6d6b1b3f19a6010fc043f694f0550e2c
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 n*(n+1)*(2*n+1)//3
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: (3,)', solve(*(3,)), 14)
check('fixture 4: (5,)', solve(*(5,)), 55)
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,) | 2 | 1 | Failed |
| fixture 3: (3,) | 28 | 14 | Failed |
| fixture 4: (5,) | 110 | 55 | Failed |
SHA-256 / 254dd53fe1e276bf610eb5ae7d8248a3b0fb0b33c3d5a676e1be8e261a798dcc
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 n*(n+1)*(2*n+1)//6
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: (3,)', solve(*(3,)), 14)
check('fixture 4: (5,)', solve(*(5,)), 55)
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: (3,) | 14 | 14 | Passed |
| fixture 4: (5,) | 55 | 55 | Passed |
SHA-256 / e2807e54d751b2bef4d2f1cbd9a45f2b16b44a99b041beee8a5e4fdad5268ef5
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:49.594399+00:00.
Case digest / 9ca63abdfd85e8b21f5728833014c40e8279bde53ac32a9a4943334904506087