FAILURE MAP
← Case archive

FA-5446 / Integer arithmetic / Open access

Triangular number · case 01

The final term is omitted from the arithmetic-series identity.

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

ROOT CAUSE

The final term is omitted from the arithmetic-series identity.

VERIFIED REPAIR

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

Unsuccessful approach: Counting unordered pairs computes the preceding triangular number.

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(1..n), with n nonnegative. Exact operational definition: n*(n+1)//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(n):
    return n*n//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: (4,)', solve(*(4,)), 10)
check('fixture 4: (7,)', solve(*(7,)), 28)
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,)00Passed
fixture 2: (1,)01Failed
fixture 3: (4,)810Failed
fixture 4: (7,)2428Failed

SHA-256 / 2359763df00354364fabb43b2826ef672c349acce2bfec45b7a0cf7de4abe600

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
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: (4,)', solve(*(4,)), 10)
check('fixture 4: (7,)', solve(*(7,)), 28)
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,)00Passed
fixture 2: (1,)01Failed
fixture 3: (4,)610Failed
fixture 4: (7,)2128Failed

SHA-256 / 577acf079a82f3a3bbc7f3dbd5695508f3a9d8cdd727ebc250c69f1df2b29ec3

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
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: (4,)', solve(*(4,)), 10)
check('fixture 4: (7,)', solve(*(7,)), 28)
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,)00Passed
fixture 2: (1,)11Passed
fixture 3: (4,)1010Passed
fixture 4: (7,)2828Passed

SHA-256 / 221843bae23e3e9942218ea085a77ab5268c05c56df280409dfa5f94f28b144f

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

Case digest / a837d1ab40988ddb2c035c77e86a4e1815e3f3198f376e09d1115e9e546ff19d