FAILURE MAP
← Case archive

FA-5561 / Number theory / Open access

Squarefree predicate · case 01

A nonsquare can still contain a squared prime factor.

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

ROOT CAUSE

A nonsquare can still contain a squared prime factor.

VERIFIED REPAIR

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

Unsuccessful approach: Rejecting every divisor confuses squarefree with 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. Squarefree predicate. Exact operational definition: all(n%(p*p) for p 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 math.isqrt(n)**2 != n
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (1,)', solve(*(1,)), True)
check('fixture 2: (12,)', solve(*(12,)), False)
check('fixture 3: (6,)', solve(*(6,)), True)
check('fixture 4: (25,)', solve(*(25,)), False)
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,)FalseTrueFailed
fixture 2: (12,)TrueFalseFailed
fixture 3: (6,)TrueTruePassed
fixture 4: (25,)FalseFalsePassed

SHA-256 / 96cefa7f4162efd00a114848e193a19d5d75f322bff5e8f680daed61e698d3f4

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 all(n%p for p 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: (1,)', solve(*(1,)), True)
check('fixture 2: (12,)', solve(*(12,)), False)
check('fixture 3: (6,)', solve(*(6,)), True)
check('fixture 4: (25,)', solve(*(25,)), False)
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,)TrueTruePassed
fixture 2: (12,)FalseFalsePassed
fixture 3: (6,)FalseTrueFailed
fixture 4: (25,)FalseFalsePassed

SHA-256 / ed9e5b7372eb0f8cf5d627258e5f4514dfbd4858fef3962661096f32e3c468a6

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 all(n%(p*p) for p 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: (1,)', solve(*(1,)), True)
check('fixture 2: (12,)', solve(*(12,)), False)
check('fixture 3: (6,)', solve(*(6,)), True)
check('fixture 4: (25,)', solve(*(25,)), False)
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,)TrueTruePassed
fixture 2: (12,)FalseFalsePassed
fixture 3: (6,)TrueTruePassed
fixture 4: (25,)FalseFalsePassed

SHA-256 / 7a32536ba54da8fcfa8aba3301a64522db5ff52937840c27a0af5936e3544333

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

Case digest / 340738b08ad08a004c9e632403460dacc00103c7f04e8607b26161f8823aa3ee