FAILURE MAP
← Case archive

FA-5476 / Integer arithmetic / Open access

Sum integer range inclusive · case 01

The terminal value is excluded by a half-open iteration.

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

ROOT CAUSE

The terminal value is excluded by a half-open iteration.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return (b-a+1)*(a+b)//2

Unsuccessful approach: The term count lacks the inclusive endpoint.

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. a<=b; sum every integer in the closed interval. Exact operational definition: (b-a+1)*(a+b)//2

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(a, b):
    return sum(range(a,b))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (1, 4)', solve(*(1, 4)), 10)
check('fixture 2: (-2, 2)', solve(*(-2, 2)), 0)
check('fixture 3: (3, 3)', solve(*(3, 3)), 3)
check('fixture 4: (-4, -2)', solve(*(-4, -2)), -9)
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: (1, 4)610Failed
fixture 2: (-2, 2)-20Failed
fixture 3: (3, 3)03Failed
fixture 4: (-4, -2)-7-9Failed

SHA-256 / cd8b3241368d79180b49df6b078a188dcc06591c80354ef5552a996456aa1307

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(a, b):
    return (b-a)*(a+b)//2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (1, 4)', solve(*(1, 4)), 10)
check('fixture 2: (-2, 2)', solve(*(-2, 2)), 0)
check('fixture 3: (3, 3)', solve(*(3, 3)), 3)
check('fixture 4: (-4, -2)', solve(*(-4, -2)), -9)
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: (1, 4)710Failed
fixture 2: (-2, 2)00Passed
fixture 3: (3, 3)03Failed
fixture 4: (-4, -2)-6-9Failed

SHA-256 / 904f051401a4348ef31332f6b2c03933469c319bdfe93e9404fa147c67d02687

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(a, b):
    return (b-a+1)*(a+b)//2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (1, 4)', solve(*(1, 4)), 10)
check('fixture 2: (-2, 2)', solve(*(-2, 2)), 0)
check('fixture 3: (3, 3)', solve(*(3, 3)), 3)
check('fixture 4: (-4, -2)', solve(*(-4, -2)), -9)
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: (1, 4)1010Passed
fixture 2: (-2, 2)00Passed
fixture 3: (3, 3)33Passed
fixture 4: (-4, -2)-9-9Passed

SHA-256 / f403facbc5400d53d0cb0ee9bed3ef8a287083c24cfd5eb19b09224ccf446dbd

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

Case digest / 7c152a0a3e97a9b4e4be19854c271bafb5512777a556eda8d9f15a1e39506d61