FAILURE MAP
← Case archive

FA-15576 / Numerics / Open access

Prime power unit factorial: factorial factor coverage · case 01

The exact prime power unit factorial result violates the stated contract at factorial factor coverage.

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

ROOT CAUSE

The factorial factor coverage step uses range(1,n) instead of range(1,n+1).

THE FAILURE

The factorial factor coverage step uses range(1,n) instead of range(1,n+1).

Unsuccessful approach: The partial repair range(1,n+1,2) still violates the factorial factor coverage invariant.

Case contract

Input [n,p,e], n>=0 p prime e>=1; return product of positive integers<=n after removing ALL p factors from each, modulo p^e. Bounds: n<=64.

Why this case matters

Exact discrete arithmetic with observable algorithmic state; no floating point approximation is used.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    n,p,e=x;mod=p**e;r=1
    for v in range(1,n):
     for _ in range(30):
      if v%p!=0:break
      v//=p
     r=r*v%mod
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([3, 2, 2], 3), ([6, 2, 2], 1), ([0, 2, 1], 1), ([64, 7, 4], 282), ([0, 2, 2], 1), ([0, 2, 3], 1), ([0, 2, 4], 1), ([1, 2, 1], 1)], [([3, 2, 3], 3), ([7, 2, 2], 3), ([0, 2, 1], 1), ([64, 7, 4], 282), ([4, 2, 2], 3), ([4, 2, 3], 3), ([4, 2, 4], 3), ([5, 2, 1], 1)], [([3, 2, 4], 3), ([8, 2, 2], 3), ([0, 2, 1], 1), ([64, 7, 4], 282), ([8, 2, 3], 3), ([8, 2, 4], 11), ([9, 2, 1], 1), ([9, 2, 2], 3)], [([5, 2, 3], 7), ([9, 2, 2], 3), ([0, 2, 1], 1), ([64, 7, 4], 282), ([12, 2, 4], 15), ([13, 2, 1], 1), ([13, 2, 2], 3), ([13, 2, 3], 3)], [([5, 2, 4], 15), ([10, 2, 2], 3), ([0, 2, 1], 1), ([64, 7, 4], 282), ([17, 2, 1], 1), ([17, 2, 2], 3), ([17, 2, 3], 3), ([17, 2, 4], 11)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, solve(args), expected)
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
explicit oracle 013Failed
explicit oracle 131Failed
explicit oracle 211Passed
explicit oracle 31430282Failed
explicit oracle 411Passed
explicit oracle 511Passed
explicit oracle 611Passed
explicit oracle 711Passed

SHA-256 / 965545ea03e66f3d18abc1557e43673d7d491c1360ef7b44bd8c9e84d0ad6753

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    n,p,e=x;mod=p**e;r=1
    for v in range(1,n+1,2):
     for _ in range(30):
      if v%p!=0:break
      v//=p
     r=r*v%mod
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([3, 2, 2], 3), ([6, 2, 2], 1), ([0, 2, 1], 1), ([64, 7, 4], 282), ([0, 2, 2], 1), ([0, 2, 3], 1), ([0, 2, 4], 1), ([1, 2, 1], 1)], [([3, 2, 3], 3), ([7, 2, 2], 3), ([0, 2, 1], 1), ([64, 7, 4], 282), ([4, 2, 2], 3), ([4, 2, 3], 3), ([4, 2, 4], 3), ([5, 2, 1], 1)], [([3, 2, 4], 3), ([8, 2, 2], 3), ([0, 2, 1], 1), ([64, 7, 4], 282), ([8, 2, 3], 3), ([8, 2, 4], 11), ([9, 2, 1], 1), ([9, 2, 2], 3)], [([5, 2, 3], 7), ([9, 2, 2], 3), ([0, 2, 1], 1), ([64, 7, 4], 282), ([12, 2, 4], 15), ([13, 2, 1], 1), ([13, 2, 2], 3), ([13, 2, 3], 3)], [([5, 2, 4], 15), ([10, 2, 2], 3), ([0, 2, 1], 1), ([64, 7, 4], 282), ([17, 2, 1], 1), ([17, 2, 2], 3), ([17, 2, 3], 3), ([17, 2, 4], 11)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, solve(args), expected)
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
explicit oracle 033Passed
explicit oracle 131Failed
explicit oracle 211Passed
explicit oracle 3730282Failed
explicit oracle 411Passed
explicit oracle 511Passed
explicit oracle 611Passed
explicit oracle 711Passed

SHA-256 / af992ff9c552b2380d43d754d432213bcd7f8fe352735c005a55766e4af8d067

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A deterministic bounded teaching model. Inputs are restricted to the explicit contract; this is not a production algebra library. 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:39:28.093746+00:00.

Case digest / b4df341b17f07cf1c2af0970ab5ad1b9b026e03ac2d49ea9709275f5a8cbe8d5