FAILURE MAP
← Case archive

FA-5566 / Number theory / Open access

Multiplicative order · case 01

Starting at exponent zero returns the trivial identity.

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

ROOT CAUSE

Starting at exponent zero returns the trivial identity.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return next((k for k in range(1,m+1) if pow(a,k,m)==1),None)

Unsuccessful approach: The group size is an upper bound rather than every element order.

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. Multiplicative order. Exact operational definition: next((k for k in range(1,m+1) if pow(a,k,m)==1),None)

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(a, m):
    return next((k for k in range(m+1) if pow(a,k,m)==1),None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2, 7)', solve(*(2, 7)), 3)
check('fixture 2: (3, 7)', solve(*(3, 7)), 6)
check('fixture 3: (2, 4)', solve(*(2, 4)), None)
check('fixture 4: (1, 9)', solve(*(1, 9)), 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 fixtureActualExpectedOutcome
fixture 1: (2, 7)03Failed
fixture 2: (3, 7)06Failed
fixture 3: (2, 4)0NoneFailed
fixture 4: (1, 9)01Failed

SHA-256 / 5a7abdc0d1ba383e776d1628b455461341c3b3526e96f4dfa56b14ae6272893d

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(a, m):
    return m-1 if math.gcd(a,m)==1 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2, 7)', solve(*(2, 7)), 3)
check('fixture 2: (3, 7)', solve(*(3, 7)), 6)
check('fixture 3: (2, 4)', solve(*(2, 4)), None)
check('fixture 4: (1, 9)', solve(*(1, 9)), 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 fixtureActualExpectedOutcome
fixture 1: (2, 7)63Failed
fixture 2: (3, 7)66Passed
fixture 3: (2, 4)NoneNonePassed
fixture 4: (1, 9)81Failed

SHA-256 / 46e39b607887318b8cb2158e2e1b5cbc6a189a995b16ea25b97c5d369d8f1ac2

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(a, m):
    return next((k for k in range(1,m+1) if pow(a,k,m)==1),None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2, 7)', solve(*(2, 7)), 3)
check('fixture 2: (3, 7)', solve(*(3, 7)), 6)
check('fixture 3: (2, 4)', solve(*(2, 4)), None)
check('fixture 4: (1, 9)', solve(*(1, 9)), 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 fixtureActualExpectedOutcome
fixture 1: (2, 7)33Passed
fixture 2: (3, 7)66Passed
fixture 3: (2, 4)NoneNonePassed
fixture 4: (1, 9)11Passed

SHA-256 / 3eadcafc315806222fbe09b222cbf0d6ace61547b015ec9d474941fce0c5d5ca

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

Case digest / b8645307ee84c6680591df9c6e49df85a21c9753928d1580e32961ec53d1c70b