02.3 / Lab notebook

← Lab index

Kaprekar Geometry and LLM Reliability

Could the gaps between a model’s scores flag an answer worth checking?

Manuscript in preparation No software licence selected Source on GitHub

01 / Abstract

Start with four digits. Sort them in both directions, subtract the smaller number from the larger and repeat with the result. Of 10,000 starting states, 9,990 reach 6174 within seven steps. I studied what the gaps between the sorted digits preserve about that process. That result gave me a separate question to test on the gaps between a model’s sorted scores.

Scope and limits

Lean 4 proofs cover core counting lemmas. Formalising the full image theorem is still in progress. The use of sorted logits to route model requests remains a hypothesis.

Read the paper Manuscript in preparation · 17 pages

Kaprekar Geometry / Workflow

How the digit routine becomes a smaller graph

  1. Define the digit routine

    Keep a fixed digit width, including leading zeros. Subtract the ascending digit arrangement from the descending arrangement.

  2. Extract ordered gaps

    Use differences between paired sorted digits to represent a state.

  3. Track the reduced graph

    Follow the dynamics on the smaller graph of gap states.

  4. Weight the basins

    Count the original states each reduced state represents using exact multinomial weights.

Worked explanationWork through 3524 → 6174
Input
Keep four decimal digits: 3524. Sort them into 5432 and 2345; their ordered gaps are 5 − 2 = 3 and 4 − 3 = 1.
Decision / rule
Subtract the ascending arrangement from the descending one: 5432 − 2345 = 3087. Repeat: 8730 − 0378 = 8352.
Outcome
One more step gives 8532 − 2358 = 6174. Then 7641 − 1467 = 6174, a fixed point.

Scope of this exampleAll-identical digits reach zero: 1111 − 1111 = 0000. A repeated pair is different: 1122 gives 2211 − 1122 = 1089. This arithmetic does not validate the separate LLM hypothesis.

The graph explains exact digit dynamics. The sorted-logit hypothesis has a separate benchmark.

02 / Reproduce

Try it locally.

Run these commands from a checkout of the project. The repository includes setup details and prerequisites.

python3 -m venv .venv
.venv/bin/python -m pip install -e .
.venv/bin/kaprekar verify
Next research entry Indus Script