FAILURE MAP
← Case archive

FA-5721 / Combinatorics / Open access

Perfect binary tree total nodes · case 01

The root-at-height-zero convention is shifted by one.

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

ROOT CAUSE

The root-at-height-zero convention is shifted by one.

THE FAILURE

The root-at-height-zero convention is shifted by one.

Unsuccessful approach: Only the last level is counted.

Case contract

Nonnegative integer counts. Permutation and combination counts are zero when a requested selection exceeds the available objects. Shape sizes satisfy the preconditions stated below. Every level is full and the root has height zero; count all vertices through height. Exact operational definition: 2**(height+1)-1

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Combinatorics 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(height):
    return 2**height-1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0,)', solve(*(0,)), 1)
check('fixture 2: (1,)', solve(*(1,)), 3)
check('fixture 3: (3,)', solve(*(3,)), 15)
check('fixture 4: (5,)', solve(*(5,)), 63)
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,)01Failed
fixture 2: (1,)13Failed
fixture 3: (3,)715Failed
fixture 4: (5,)3163Failed

SHA-256 / ebbdd1769cd1f9fad5d82cec9668fe874460fa04e9cfe8aab9446b1a9fd6fc2c

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(height):
    return 2**height
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0,)', solve(*(0,)), 1)
check('fixture 2: (1,)', solve(*(1,)), 3)
check('fixture 3: (3,)', solve(*(3,)), 15)
check('fixture 4: (5,)', solve(*(5,)), 63)
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,)11Passed
fixture 2: (1,)23Failed
fixture 3: (3,)815Failed
fixture 4: (5,)3263Failed

SHA-256 / 9be10b6e9e7730c3bc20dafdea68a0c30710e094e8a4e5c71f7dbf2ea3ab204f

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 4 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

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

Case digest / 254f019e9977e7cc96fed11a1da03b38050e77e646ca592e554d3769db8be164