FAILURE MAP
← Case archive

FA-5531 / Number theory / Open access

Trailing factorial zeroes · case 01

Only one factor of five per multiple is counted.

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

ROOT CAUSE

Only one factor of five per multiple is counted.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return sum(n//(5**i) for i in range(1,n.bit_length()+1))

Unsuccessful approach: Testing whether n itself is divisible ignores factors in preceding terms.

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. Return the number of trailing base-ten zero digits in n!. Exact operational definition: sum(n//(5**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):
    return n//5
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: (5,)', solve(*(5,)), 1)
check('fixture 3: (25,)', solve(*(25,)), 6)
check('fixture 4: (100,)', solve(*(100,)), 24)
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: (5,)11Passed
fixture 3: (25,)56Failed
fixture 4: (100,)2024Failed

SHA-256 / 25b782e337165a7a028c80b4bf3ede28f08a7e26ff090ec3edb88919cb96bfa6

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 sum(n%(5**i)==0 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: (0,)', solve(*(0,)), 0)
check('fixture 2: (5,)', solve(*(5,)), 1)
check('fixture 3: (25,)', solve(*(25,)), 6)
check('fixture 4: (100,)', solve(*(100,)), 24)
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: (5,)11Passed
fixture 3: (25,)26Failed
fixture 4: (100,)224Failed

SHA-256 / 648998c2a70f3a5515cb0b9746376e4fbad4ed0d7cca196bc120b462ad533a95

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 sum(n//(5**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: (0,)', solve(*(0,)), 0)
check('fixture 2: (5,)', solve(*(5,)), 1)
check('fixture 3: (25,)', solve(*(25,)), 6)
check('fixture 4: (100,)', solve(*(100,)), 24)
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: (5,)11Passed
fixture 3: (25,)66Passed
fixture 4: (100,)2424Passed

SHA-256 / b97651b939d6bb1adaeeb0589b14cfc74ba8e6c6efc8c8e10ae2d0f21370f0f2

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

Case digest / ec352940b74310803c05a820ae9b663c81d92af31c35342dd59bdf718bd6422b