FA-5536 / Number theory / Open access
Factorial prime valuation · case 01
Prime-power multiplicities in a factorial are omitted.
ROOT CAUSE
Prime-power multiplicities in a factorial are omitted.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return sum(n//p**i for i in range(1,n.bit_length()+1))
Unsuccessful approach: Counting divisible terms still counts each term only once.
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>=0 and p is prime. Return the exponent of p in the prime factorization of n!. Exact operational definition: sum(n//p**i for i in range(1,n.bit_length()+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, p):
return n//p
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (8, 2)', solve(*(8, 2)), 7)
check('fixture 2: (10, 3)', solve(*(10, 3)), 4)
check('fixture 3: (0, 2)', solve(*(0, 2)), 0)
check('fixture 4: (5, 5)', solve(*(5, 5)), 1)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: (8, 2) | 4 | 7 | Failed |
| fixture 2: (10, 3) | 3 | 4 | Failed |
| fixture 3: (0, 2) | 0 | 0 | Passed |
| fixture 4: (5, 5) | 1 | 1 | Passed |
SHA-256 / 8d435a144d56771d36d34dc937c79a355366752e71554886be69c4b973d66c3f
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, p):
return sum(1 for i in range(1,n+1) if i%p==0)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (8, 2)', solve(*(8, 2)), 7)
check('fixture 2: (10, 3)', solve(*(10, 3)), 4)
check('fixture 3: (0, 2)', solve(*(0, 2)), 0)
check('fixture 4: (5, 5)', solve(*(5, 5)), 1)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: (8, 2) | 4 | 7 | Failed |
| fixture 2: (10, 3) | 3 | 4 | Failed |
| fixture 3: (0, 2) | 0 | 0 | Passed |
| fixture 4: (5, 5) | 1 | 1 | Passed |
SHA-256 / 480533ca36f7efbaf1555e6f7a4a71a5c924c3b1c71d4d398bd2c9ce7ab9778d
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, p):
return sum(n//p**i for i in range(1,n.bit_length()+1))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (8, 2)', solve(*(8, 2)), 7)
check('fixture 2: (10, 3)', solve(*(10, 3)), 4)
check('fixture 3: (0, 2)', solve(*(0, 2)), 0)
check('fixture 4: (5, 5)', solve(*(5, 5)), 1)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: (8, 2) | 7 | 7 | Passed |
| fixture 2: (10, 3) | 4 | 4 | Passed |
| fixture 3: (0, 2) | 0 | 0 | Passed |
| fixture 4: (5, 5) | 1 | 1 | Passed |
SHA-256 / d32290abddf7eac3167475b18db8f5921acf6f90a197f0406041fc8b7795a064
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.666116+00:00.
Case digest / 3ca8253a61272284984ba1c256aaa95417f15cd02a4d664b0c45fdbeb57f0f6b