FAILURE MAP
← Case archive

FA-5506 / Number theory / Open access

Prime predicate small boundary · case 01

The empty divisor loop falsely accepts zero and one.

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

ROOT CAUSE

The empty divisor loop falsely accepts zero and one.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return n>=2 and all(n%d for d in range(2,math.isqrt(n)+1))

Unsuccessful approach: Excluding the lower boundary also excludes the first prime.

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 nonnegative integer; zero and one are not prime. Exact operational definition: n>=2 and all(n%d for d in range(2,math.isqrt(n)+1))

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 all(n%d for d in range(2,math.isqrt(max(0,n))+1))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0,)', solve(*(0,)), False)
check('fixture 2: (1,)', solve(*(1,)), False)
check('fixture 3: (2,)', solve(*(2,)), True)
check('fixture 4: (9,)', solve(*(9,)), False)
check('fixture 5: (13,)', solve(*(13,)), True)
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,)TrueFalseFailed
fixture 2: (1,)TrueFalseFailed
fixture 3: (2,)TrueTruePassed
fixture 4: (9,)FalseFalsePassed
fixture 5: (13,)TrueTruePassed

SHA-256 / 1212f55986e33654049b30dd5178405df0e8998769144e1f9bf3257f90e2186d

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>2 and all(n%d for d in range(2,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,)), False)
check('fixture 2: (1,)', solve(*(1,)), False)
check('fixture 3: (2,)', solve(*(2,)), True)
check('fixture 4: (9,)', solve(*(9,)), False)
check('fixture 5: (13,)', solve(*(13,)), True)
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,)FalseFalsePassed
fixture 2: (1,)FalseFalsePassed
fixture 3: (2,)FalseTrueFailed
fixture 4: (9,)FalseFalsePassed
fixture 5: (13,)TrueTruePassed

SHA-256 / f9b0c21f357f77b8eb4a455d38692088edfb668f1897025381dba43ebb8cecd1

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>=2 and all(n%d for d in range(2,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,)), False)
check('fixture 2: (1,)', solve(*(1,)), False)
check('fixture 3: (2,)', solve(*(2,)), True)
check('fixture 4: (9,)', solve(*(9,)), False)
check('fixture 5: (13,)', solve(*(13,)), True)
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,)FalseFalsePassed
fixture 2: (1,)FalseFalsePassed
fixture 3: (2,)TrueTruePassed
fixture 4: (9,)FalseFalsePassed
fixture 5: (13,)TrueTruePassed

SHA-256 / 3e0a8a5fa6a3c446db839395c1438aa9a7e4a2ba4ae7e68d0e484386c22395e4

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

Case digest / 65792584e99c9eafa97b64183216d79eec98a796bdcd8ea7f733898cce34f4df