# PrimeMind Prime-Power Factor Matrix Lab v2.5

## New page: Gap balance

Version 2.5 adds a dedicated **Gap balance** tab to the existing Prime-Power Factor Matrix and Gap Sequence Growth laboratory.

The new page treats the selected structural quantity in a completed prime gap as an ordered nonnegative mass distribution. It keeps two questions separate:

1. **Internal shape balance:** where the observed mass accumulates from the lower prime to the upper prime.
2. **Absolute recurrence drift:** how the observed cumulative amount differs from the smooth amount implied by the permanent coordinate frequencies.

The page is deliberately descriptive. It uses the completed right-hand prime and revealed factorizations. Any later predictive use must freeze its metric, normalization, controls, and decision rule before the target gap is revealed.

## Controls

### Structural mass

- **Active prime-power cells Ω** — one unit for every active nested prime-power coordinate.
- **Composite support Ω−1** — removes one largest-prime-factor occurrence.
- **Distinct prime bases ω** — one unit for every occupied prime column.
- **Higher-power cells Ω−ω** — counts active cells above exponent level 1.
- **Log support log(n/LPF)** — weighted support after removing one largest-prime-factor occurrence.
- **Full weighted fingerprint log n** — the sum of log-prime weights over the complete fingerprint.
- **Prime-power source Λ(n)** — log p at a pure prime power p^a and zero otherwise.

### Rows included

- **Interior integers only** is the default and excludes the two prime boundaries.
- **Include both prime boundaries** includes the lower and upper primes as rows of the distribution.

### Order controls

- **Parity-preserving shuffles** randomly permute the same row masses only among positions having the same parity.
- **Unrestricted shuffles** randomly permute all row masses.
- **No control envelope** draws only the observed curve.

The shaded control envelope is the 5th-to-95th percentile band over 64, 128, or 256 deterministic shuffles. It is a descriptive control, not a formal confidence interval.

## Main quantities

For a selected list of m ordered rows with nonnegative masses w_1,...,w_m, let

- x_j = j/m be the normalized position after row j,
- W = sum_j w_j be the completed mass,
- F_j = (w_1+...+w_j)/W be the normalized cumulative mass.

The **balance bridge** is

    B_j = F_j - x_j.

It starts at zero and returns to zero at the end.

- B > 0 means structural mass accumulated earlier than a uniform row distribution.
- B < 0 means it accumulated later.

The page also reports:

- the half-mass crossing x_50,
- the factor-mass center of gravity,
- left and right shares,
- right-minus-left imbalance,
- maximum positive and negative bridge excursions,
- maximum absolute bridge,
- RMS bridge size,
- signed bridge area.

Under the page's equal-width-bin convention, the signed bridge area equals

    1/2 - mass center.

## Finite-coordinate expectation

For additive recurrence metrics, a second chart uses the permanent coordinate frequencies rather than the observed completed-gap total.

Examples:

- Ω rate: sum over born coordinates 1/q^a,
- ω rate: sum over born base coordinates 1/q,
- higher-power rate: sum over a >= 2 of 1/q^a,
- Λ rate: sum log(q)/q^a over born prime-power coordinates.

The cumulative expectation drift need not return to zero. Its endpoint records an absolute finite-interval excess or deficit.

## Atomic coordinate discrepancy

The table **Atomic coordinate discrepancy for Ω** compares every coordinate q^a with

    interval length / q^a.

For a consecutive interval, one coordinate's actual hit count differs from this smooth expectation by less than one activation. The signed coordinate discrepancies add to the total Ω excess.

## Charts

1. Normalized cumulative structural mass versus the diagonal y=x.
2. Residual bridge F(x)-x.
3. Per-integer unaccumulated mass profile.
4. Cumulative drift from the finite-coordinate frequency expectation.
5. The selected statistic across 21, 51, or 101 neighboring prime gaps.

Clicking a point or position in the charts selects the corresponding integer or completed gap.

## Component tables

- Per-integer balance records.
- Prime-base decomposition with left/right mass and center.
- Power-level decomposition with left/right mass and center.
- Atomic q^a recurrence discrepancies.

## Exports

- Current balance profile CSV.
- Complete balance package JSON.
- Nearby-gap balance CSV.
- Cumulative chart PNG.
- Bridge chart PNG.

The general complete-state JSON now also embeds the current gap-balance package.

## Important one-half distinction

The normalized reference lines x=1/2 and F=1/2 belong to the geometry of a rescaled finite gap. They are not, by themselves, the real coordinate 1/2 in the Riemann hypothesis. The research question is whether the **deviations around the normalized balance reference**, and their scaling across ranges, reveal a useful invariant.

## Validation

The built-in smoke test was run through N=200,000. It verified:

- the gap 271 -> 277 has interior Ω mass 17,
- the normalized bridge begins and ends at zero,
- the atomic coordinate count reproduces the same Ω mass,
- the balance CSV has one row per included integer,
- the JSON package contains the audited balance summary,
- all balance canvases render.

An additional browser sweep exercised all 42 combinations of seven structural metrics, two row scopes, and three control modes without a JavaScript error.
