Snippets Concepts Lottery Pruning

Index for Snippets Concepts Lottery Pruning



Preface


gold 4/5/2026. Advisor requests similar to previous snippets, but on topic of "lottery ticket pruning algorithms" on Collatz variants and using modular snippets inside modular structured programs.


I do not have all the answers. The Ideas Seemed to work, but maybe drawbacks? When measured by the Tcl timing statements, completion times and solutions of parameters will differ on different computer set-ups. Assume a future maintainer, either AI Model or human programmer, would have to maintain code with info content and explanatory variable name in program, ref "Snippets Concepts Effects". The Nassi Shneiderman Diagrams NSD or Flowcharts pertain to the Tool Control Language TCL computer language as well as other computer languages like Python 3, pseudocode, word logic problems, and technical reports.


For each logic condition selecting a path or calculation task, we might have one, two, or multiple deterministic branches. Attempting to adapt format to multiple probabilistic branches used in Artificial Intelligence AI Models. Then we use the lottery pruning algorithm to select the winning pathways or tickets. "lottery pruning algorithms" are reportedly used in some LLM models.


Particularly, the Collatz Conjecture offers a variety of situations where the NDS diagrams are useful in studying the low level logic of sequence calculations. Examines the iterative sequence for the question of how many steps, or iterations, each number requires before reaching 1 remains central. Since the Collatz Sequences are infinite, we will be modeling core concepts as flowcharts, but will simplify to ideal behavior in models/code and probably truncate after the interesting portions.


Limitations on Tool and Disclaimer


The TCL Snippets illustrate ideal mathematical behavior only and do not perform full simulation, actual measurements, or state vector evolution. The tool only visualizes ideal math structure, whereas no state vector simulation, probabilities, or actual measurement outcomes are derived. This tool for visualization does not simulate actual measurement outcomes or state vector evolution during operations. These are idealized protocols for tutorial purposes. Primarily, TCL /TK uses its strong points here for book keeping and displays. The example tool is not a full emulator. Meaning, limited scope for tutorial purposes.


Disclaimer. None of the computer programs, numerical experiments, power-law fits, or physical analogies described here give a strict, formal proof of the Collatz Conjecture, either individually or in combination. The tools and analogies are heuristic models and visualization tools that follow engineering “rules of thumb.” Whereas, pure mathematics has its own shop rules for what counts as a rigorous proof. Any opinions on the difficulty or plausibility reflect current understanding here and programming of the Collatz Conjecture as a very hard open problem, not a completed exact math proof, and are offered with full respect for the standards of professional mathematicians.


Extra Significant Figures, If Any in Debugging


In debugging the calculations, some of the printout values reflect roughly 17-digit precision output from a typical double-precision computation. It's not "true exact" beyond 5 significant figures. Extra significant figures are used to check the calculations from other computer set-ups, not necessarily to infer accuracy of data measurements here. Typically, the slight differences in decimal places on far right of decimal point are normal floating-point behavior in Tcl's expr.


Introduction


The Lottery Ticket Hypothesis (Frankle & Carbin, 2018) is highly relevant. The Collatz AI program already uses a small set of "weights" (the 6 signals: p, t, b, bu, r, e) that guide decisions. these signals may be treated exactly like neural network weights. The pruning and winning tickets can be explored in a clean, modular way. This program adds a pruning and winning ticket layer on top of the 6 signals. The Core Idea is to "prune" or disable the weakest signals and measure whether the remaining sparse signal set still performs well (fast convergence, low loop rate). This directly simulates the Lottery Ticket Hypothesis in a visible and educational way .


This TCL Program directly tests the Lottery Ticket Hypothesis on the 6 AI signals. At 0% pruning gives full model. At 40–60% pruning, often still see very good performance or winning tickets. At 80% pruning gives performance usually collapses and much like random reinitialization in the paper.


Lottery Tickets in Biology


The Lottery Ticket Hypothesis has clear parallels and analogs in biology. Biological systems often begin massively over-parameterized. Then selectively preserve sparse, but highly effective sub-systems. This pruning of sub-systems or reduction pattern appears in brains, immune systems, gene regulation, development, and evolution. The table covers biological analogs to the Lottery Ticket Hypothesis. There are vast differences in biological applications and computer terminology.



AI style Algorithm of the Collatz Conjecture


gold 4/11/2026. This TCL program was written to simulate an Artificial Intelligence AI style Algorithm of the Collatz Conjecture. Program deck contains multiple estimation procs. First, a separate state machine that computes some samples of the Collatz sequences by standard deterministic iteration. As a second proc set for comparison, a separate AI-style Algorithm was computed as probabilistic random walk choices. The program implements 6 Artificial Intelligence (AI) weighting signals — parity, trend pressure, bit pressure, budget pressure, repeat Risk, and entropy Pressure. There is a diagnostic printout with the "hooks" or variable diagnostics to address AI-like simulation parameters. This program gets gritty pretty fast. These probabilistic variants do not prove the original conjecture.


At inference time, the typical LLL model does not explore thousands of independent token branches in a brute-force way. Instead, the AI diagnostic parameters constrain the probability distribution over the next token to a narrow, coherent set of likely choices. Obviously, thousands of token values would cost computer time, beyond the scope here. Maybe 4-12 weighted branch "tokens" would give the human reader the flavor of AI handling the Collatz numbers, bound by the architected modular AI weighting system. Using typical transformer architecture parameters as a problem constraint as opposed to thousands of weighted token branches. in other words, the TCL program does not model the sheer volume of LLM token branches.


In the TCL program, the six signals in computeAiWeights act as lightweight constraints. The signals are Parity, trendPressure, bitPressure, and budgetPressure., repeat Risk, and entropy Pressure. The six signals together bias the choice between standard and swapped actions. This approach avoids simulating the full explosion of token-level branches that an LLM would face with a vocabulary of 50,000 or more token entries. The artificial intelligence (AI) weighting module computes a simple two-way decision (standard versus swapped) under those constraints.


The temperature measurement in large language models serves as a diagnostic tool for controlling randomness during sampling. Classic AI temperature does not exist as a direct setting in the current Probabilistic Collatz Variant program. For here, AI-like Temperature is estimated more as a follow-up diagnostic concept that measures how closely the probabilistic choices stay to the standard deterministic Collatz behavior. The current program used with the default settings, and without explicit temperature, already leans conservative. Current code favors contraction and avoids excessive divergence as default. Adding temperature as a tunable diagnostic would let users experiment with hotter or cooler runs.


The temperature control now behaves somewhat like in transformer-based large language models while keeping the program lightweight and fully auditable. The output file clearly shows how temperature affects closeness to the deterministic reference. Once the console is opened, successive commands with the various seed and temperature options will preserve your "scorecards" on the Collatz Sequences.


  • runTestSuite 0 → default random seed and default temperature 1.0 (recommended starting point)
  • runTestSuite 0 1.0 → default random seed and default temperature 1.0 (recommended starting point)
  • runTestSuite 0 0.7 → lower temperature choices < 1.0 , stay much closer to standard Collatz iterations
  • runTestSuite 0 1.4 → higher temperature choices > 1.0 , higher chance of swapped actions and loop detection, farther from standard Collatz
  • runTestSuite 7777487989 1.4 → more exploration, different random seed integers!, higher chance of swapped actions and loop detection


Recommended Expanded Test Set (20–25 cases). Many short numbers (2, 3, 5, 7, 9, 15, 25, 100) finish in under 30 steps. Meaning, signals like budgetPressure and bitPressure barely have time to activate. Only a few long ones (27 and 97) show the full dynamics. Get very few data points for repeatRisk and entropyPressure in action across many different regimes.


Short / Easy (baseline behavior): 2, 3, 5, 7, 9, 15, 21, 25, 31, 63
Medium (good signal activity): 27, 41, 57, 73, 85, 97, 111, 129
Long / Challenging (rich signal data): 637, 703, 871, 1132, 1234, 6171, 9663, 18127, 270271
Very Large (tests safety signals): 1000000, 9999999


Observed Winning Tickets from Test Runs


From experiments on the 10 test seeds, typical winning tickets include:

Seed 27 (long hailstone): Best ticket = p, t, e (Parity + Trend + Entropy) → 33% size reduction, still faster convergence.
Seed 5 & 15 (loop-prone): Best ticket = p, r, e (Parity + RepeatRisk + Entropy) → strong loop prevention.
Seed 97 (very long): Best ticket = p, b, bu, r (Parity + Bit + Budget + Repeat) → safety-focused ticket.

Temperature Behavior from Preliminary Observations


  • T=0.7 (cooler): Smallest tickets, less signals kept, fastest convergence, highest reduction. Very conservative, close to deterministic Collatz.
  • T=1.0 (default): Balanced trade-off. Good sparsity (average ~45% reduction) and reliable convergence.
  • T=1.4 (hotter): Larger tickets, more signals kept, longer paths, lower reduction. More exploratory, higher loop risk, but sometimes discovers interesting alternative trajectories.

The 6 signals (Parity, TrendPressure, BitPressure, BudgetPressure, RepeatRisk, EntropyPressure) continue to act as lightweight constraints. The AI weighting module computes a simple two-way decision (standard vs swapped) under those constraints, avoiding the explosion of 50,000+ token branches that a real LLM would face.


Summary



The Collatz conjecture is an ideal playground for teaching AI concepts. The problem is simple enough to run in Tcl, yet rich enough to expose parity bias, expansion risk, repetition penalties, entropy, and budget pressure. These are exactly the same ideas that appear in transformer attention and sampling.


The program proves that “AI-like” behavior can be achieved with only 6 floating-point calculations per step. This is valuable for collegiate labs: students can see the signals change in real time, modify the coefficients, and immediately observe the effect on convergence rate and loop frequency.


Temperature control is the single most powerful pedagogical tool in the system. Students can run the suite at 0.7 (very deterministic) versus 1.5 (highly exploratory) and watch the average P-D difference swing from negative to positive. This directly illustrates how LLMs trade creativity for coherence. The dual-output design (console + collatz_results.txt) and automatic wiki tables make the program self-documenting.





References


  • Snippets Concepts Collatz Plotter
  • Snippets Concepts Geometric Tunneling
  • Snippets Concepts Collatz T-Stop
  • Snippets Concepts Random Cubics
  • Snippets Concepts McCarthy 91_Function
  • Snippets Concepts Predator Prey
  • Snippets Concepts Thomas Solver
  • Snippets Concepts Grover Simulation
  • Snippets Concepts Radioactive Decay
  • Snippets Concepts Hypersphere Simulation
  • Snippets Concepts Nassi Shneiderman Flowcharts
  • Snippets Concepts SlideRule to Quantum
  • Snippets Physics Concepts Qubits
  • Snippets Physics Concepts Feynman
  • Snippets Physics Concepts Quantum
  • Snippets Physics Concepts Toy
  • Snippets Physics Concepts Minimalism
  • Zero Handling Workarounds

Note. These Snippets on Theoretical Physics are a set, not stand alones. Recommend read all of the set.


  • A little slide-rule on TCL Wiki, ( much credit for the algorithms in the sliderule. )
  • Richard Suchenwirth 2003-08-31
  • Smoothing and differentiation of data by simplified least squares procedures
  • Savitzky, A. ; Golay, M. J. E. Two examples are presented as subroutines in the FORTRAN language.
  • Savitzky Golay Filtering, Python
  • Savitzky Golay Filtering — SciPy Cookbook documentation
  • Smoothing Example with Savitzky-Golay Filter in Python
  • Introduction to the Savitzky-Golay Filter: A Comprehensive Guide (Using Python), Thomas Konstantinovsky
  • Konstantinovsky has good explanation. Note detailed. WhittakerSmoother in Python
  • The Perfect Way to Smooth Your Noisy Data, Whittaker-Eilers smoother, Andrew Bowell
  • Feb 28, 2024

  • A Basis for a Mathematical Theory of Computation,Author(s)
  • McCarthy, John
  • John McCarthy: A basis for a mathematical theory of computation, in:
  • Computer Programming and Formal Systems.
  • P.Braffort, D.Hirschberg (ed.), Amsterdam:North Holland 1963,
  • several versions, archived pdf
  • McCarthy’s LISP and Basis for Theory of Computation, archived pdf
  • en.wikipedia.org search on <John McCarthy computer>
  • John McCarthy at Stanford web site, archived
  • Towards a Mathematical Science of Computation, J. McCarthy,
  • Computer Science Department, Stanford University, archived pdf
  • Elephant 2000: A Programming Language Based on Speech Acts
  • John McCarthy, Stanford University, archived
  • Elephant input and output statements are characterized
  • as speech acts and programs, which
  • can refer directly to the past.
  • Elephant proposal contains summary
  • on McCarthy mathematical theory of computation
  • Mysteries and other Matters, development of Lisp , archived
  • Note. A lot of early papers and notes from John McCarthy and Knuth are difficult to assess web links or archived.

  • Machine Learning Approaches to the Collatz Conjecture:
  • A Comprehensive Framework for Pattern Recognition
  • and Automated Conjecture Generation. IJIRT, Vol. 12 Issue 7
  • Transformers Know More Than They Can Tell:
  • Learning the Collatz Sequence , arXiv:2511.10811
  • The Collatz conjecture, Littlewood-Offord theory, and powers of 2 and 3,
  • Aug 2011, Terence Tao,
  • mentions Gambler's Ruin on this 2011 post, but better search on his website for updates.

  • Efficient Computation of Collatz Sequence
  • Stopping Times: A Novel Algorithmic Approach ( credit for the new algorithm. )
  • EYOB SOLOMON GETACHEW, BEAKAL GIZACHEW ASSEFA
  • The Collatz Conjecture over the Gaussian Integers, Alejandra Alvarado

  • An example of the difference between quantum and classical random walks
  • Andrew M. Childs, Edward Farhi, Sam Gutmann ( much credit for the new algorithm. )

  • Simple Program Design, Lesley Anne Robertson, 2004
  • Lecture in Spanish, diagrama de nassi schneiderman o rectángular
  • website for estudia con nancho, 2023
  • Lecture, Communicating Complex Logic with Ease
  • with Nassi-Shneiderman Diagrams, Atanas Marchev,
  • Jetbrains MPS community, 2023
  • Java library for working with Nassi-Shneiderman diagrams
  • (structograms) from Atanas Marchev, Github website
  • Flowchart techniques for structured programming
  • Authors: I. Nassi, B. Shneiderman, circa 1973
  • KernelF- an Embeddable and
  • Extensible Functional Language, Markus Voelter
  • voelter = acm, ~~ 2023
  • Algorithmic Accountability: Designing for Safety , Ben Shneiderman,
  • Radcliffe Institute, 2018

  • the lottery ticket hypothesis:
  • finding sparse, trainable neural networks, jonathan frankle, mit
  • 4 mar 2019, michael carbin

Screenshots




Figure. Snippets Concepts First 700 Collatz Pts.


Log2 vs Log2 plot is closest to a lion tamer that I know. Points would follow straight line if linear data. Some points or "binary probabilistic bins in computer lingo" are reused and overlaid, making a cleaner look to a non-linear function.


Snippets Concepts SlideRule pts




Figure. Classic Nassi Shneiderman Examples from Other Languages, Python


Classic NSD graphs drawn here, rest of page is based on Wiki table format.


Snippets Concepts NDS_1



Figure. Classic Nassi Shneiderman Examples from Other Languages, Python


Snippets Concepts NDS_2



Figure. Classic Nassi Shneiderman Examples from Other Languages, Qbasic


Snippets Concepts NDS_3


**** figure. LOTTERY TICKET PRUNING ON PROBABILISTIC COLLATZ **** 

+----------------------------------------------------------------------------------+
| LOTTERY TICKET PRUNING - V12                                                     |
|                                                                                  |
|    Full Model (6 Signals)  →  Iterative Pruning  →  Winning Ticket               |
|                                                                                  |
|    Baseline (all signals)                                                        |
|         │                                                                        |
|         ▼                                                                        |
|    Try dropping one signal → Test convergence                                    |
|         │                                                                        |
|         ▼                                                                        |
|    Keep best reduced set → Repeat until no improvement                           |
|                                                                                  |
|    Goal: Find sparse "winning ticket" with fewer signals but similar/better steps|
+----------------------------------------------------------------------------------+

**** figure. THE 6 AI SIGNALS **** 
+----------------------------------------------------------------------------------+
| 6 AI SIGNALS USED IN COLLATZ DECISION ENGINE                                     |
|                                                                                  |
|    Signal            Purpose                                 Effect               |
|    ───────────────   ────────────────────────────────────   ───────────────────   |
|    Parity            Even / Odd status                       Base weight          |
|    TrendPressure     Rising values in last 3 steps           Encourages expansion |
|    BitPressure       Bit length of current n                 Blowup risk warning  |
|    BudgetPressure    Steps used vs total limit               Urgency to finish    |
|    RepeatRisk        Number seen recently                    Loop prevention      |
|    EntropyPressure   Variance in recent values               Chaos / randomness   |
|                                                                                  |
|    Lottery Ticket Pruning tries turning each signal OFF to find sparse winners   |
+----------------------------------------------------------------------------------+

**** figure. PRUNING PROCESS FLOW **** 

+----------------------------------------------------------------------------------+
| LOTTERY TICKET PRUNING PROCESS                                                   |
|                                                                                  |
|    Start with Full Mask (All 6 Signals ON)                                       |
|             │                                                                    |
|             ▼                                                                    |
|    Run Walk → Record Baseline Steps                                              |
|             │                                                                    |
|             ▼                                                                    |
|    For each signal:                                                              |
|        Turn OFF one signal → Run Walk                                            |
|             │                                                                    |
|             ▼                                                                    |
|        Better steps? → Keep new mask                                             |
|             │                                                                    |
|             ▼                                                                    |
|    Repeat until no further improvement                                           |
|                                                                                  |
|    Output: Kept Signals | Dropped Signals | Ticket Steps | Reduction %           |
+----------------------------------------------------------------------------------+

**** figure. BASELINE vs WINNING TICKET COMPARISON **** 

+----------------------------------------------------------------------------------+
| BASELINE vs WINNING TICKET                                                       |
|                                                                                  |
|    Model               Signals Used   Steps   Reduction   Notes                  |
|    ─────────────────   ─────────────   ─────   ─────────   ───────────────────   |
|    Full Baseline       6 / 6          271      0%         All signals active     |
|    Pruned Ticket       4 / 6           3      33%         Dropped bit+budget     |
|    Pruned Ticket       5 / 6           4      16%         Dropped repeat         |
|                                                                                  |
|    Goal: Maintain convergence with fewer signals (sparse winning ticket)         |
+----------------------------------------------------------------------------------+

**** figure. OVERALL PROGRAM ARCHITECTURE **** 

+----------------------------------------------------------------------------------+
| PROBABILISTIC COLLATZ + LOTTERY TICKET PRUNING V12                              |
|                                                                                  |
|    seedTheRandom                                                                 |
|         │                                                                        |
|         ▼                                                                        |
|    ┌─────────────────────┐   ┌─────────────────────┐                            |
|    │ runDetStateMachine  │   │ runAiProbCollatz    │                            |
|    │ (Deterministic)     │   │ (Full AI Model)     │                            |
|    └──────────┬──────────┘   └──────────┬──────────┘                            |
|               │                         │                                         |
|               └──────────────┬──────────┘                                         |
|                              ▼                                                    |
|                    findLotteryTickets (Pruning Engine)                           |
|                              │                                                    |
|                              ▼                                                    |
|                    printAllResults → 3 Wiki Tables                               |
|                                                                                  |
|    Output: Kept/Dropped signals, Ticket Steps, Reduction %                       |
+----------------------------------------------------------------------------------+

**** figure. LOTTERY TICKET RESULTS SUMMARY **** 

+----------------------------------------------------------------------------------+
| LOTTERY TICKET PRUNING RESULTS                                                   |
|                                                                                  |
|    Many seeds work well with only 3–4 signals active                             |
|    Reduction % shows how much the model can be sparsified                        |
|                                                                                  |
|    Key Insight: Not all 6 signals are equally important                          |
|    Some combinations are "winning tickets" — sparse yet powerful                 |
+----------------------------------------------------------------------------------+


Table, Partial Collatz_Sequences for the lower integers


table, printed in TCL format, Partial Collatz Sequences up to 30, omitting long/infinite tails for brevity.


Index No. # number steps shown partial sequence note
1 1 0 1 (already at end)
2 2 1 2 1
3 3 7 3 10 5 16 8 4 2 1
4 4 3 4 2 1
5 5 5 5 16 8 4 2 1
6 6 8 6 3 10 5 16 8 4 2 1
7 7 16 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
8 8 3 8 4 2 1
9 9 19 9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
10 10 6 10 5 16 8 4 2 1
11 11 14 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
12 12 9 12 6 3 10 5 16 8 4 2 1
13 13 9 13 40 20 10 5 16 8 4 2 1
14 14 17 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
15 15 17 15 46 23 70 35 106 53 160 80 40 20 10 5 16 8 4 2 1
16 16 4 16 8 4 2 1
17 17 12 17 52 26 13 40 20 10 5 16 8 4 2 1
18 18 20 18 9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
19 19 20 19 58 29 88 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
20 20 7 20 10 5 16 8 4 2 1
21 21 7 21 64 32 16 8 4 2 1
22 22 15 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
23 23 15 23 70 35 106 53 160 80 40 20 10 5 16 8 4 2 1
24 24 10 24 12 6 3 10 5 16 8 4 2 1
25 25 23 25 76 38 19 58 29 88 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
26 26 10 26 13 40 20 10 5 16 8 4 2 1
27 27 111 27 82 41 124 62 31 94 47 142 71 214 107 322 161 484 242 121 364 182 91 274 ... very long, abbreviated here
28 28 18 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
29 29 18 29 88 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
30 30 18 30 15 46 23 70 35 106 53 160 80 40 20 10 5 16 8 4 2 1

Notes:


“Steps shown” counts transitions before hitting 1 (where and if it does).


Integer Sequences such as for 27 grow extremely long — only a partial chain is included.


All integers up to 30 that reduce to 1 have been fully shown to that endpoint; longer or nonterminating cases would be truncated.


Collatz sequences below 2 are not defined fully, at least in terms of >> my << computing algorithms. Listing Integers 1 and 2 for completeness of table, but questions on definition remains here.



Table , Quick Prime π Estimates for Collatz-scale numbers


Cutoff date is 2/14/2026.


Index No. # n log2(n) Legendre_Primes_Est Calibrated Actual(known) est bits for N Sequence (up to 20 terms) quibble note
1 2 1.0 1 1 2 2→1 Smallest even; trivial cycle 2→1
2 3 1.58 2 2 2 3→10→5→16→8→4→2→1 Classic odd starter: 3→10→5→16→8→4→2→1 (7 steps)
3 4 2.0 2 2 3 4→2→1 Power of 2; quick to 1
4 5 2.32 3 3 3 5→16→8→4→2→1 5→16→... (5 steps)
5 6 2.58 3 3 3 6→3→10→5→16→8→4→2→1 Even; merges quickly
6 7 2.81 4 4 3 7→22→11→34→17→52→26→13→40→20→10→5→16→... 7→22→11→34→17→52→26→13→40→20→10→5→16→... (16 steps)
7 8 3.0 4 4 4 8→4→2→1 Power of 2
8 9 3.17 4 4 4 9→28→14→7→... 9→28→14→7→... (19 steps)
9 20 4.32 8 8 5 20→10→5→16→8→4→2→1 Merges early
10 27 4.75 9 9 5 27→82→41→124→62→31→94→47→142→71→214→107→322→... Famous: longest sequence under 100 (111 steps, reaches 9232)
11 30 4.91 10 10 5 30→15→46→23→70→35→106→53→160→80→40→20→10→5→16→... Even; moderate
12 40 5.32 12 12 6 40→20→10→5→16→8→4→2→1 Power-of-2 like path
13 50 5.64 15 15 6 50→25→76→38→19→58→29→88→44→22→11→34→17→52→26→13→40→20→10→5→...
14 60 5.91 17 17 6 60→30→15→46→23→70→35→106→53→160→80→40→20→10→5→16→8→4→2→1
15 70 6.13 19 19 7 70→35→106→53→160→80→40→20→10→5→16→8→4→2→1
16 90 6.49 24 24 7 90→45→136→68→34→17→52→26→13→40→20→10→5→16→8→4→2→1
17 200 7.64 46 46 8 200→100→50→25→76→38→19→58→29→88→44→22→11→34→17→52→26→13→40→... Power of ten region
18 300 8.23 62 62 9 300→150→75→226→113→340→170→85→256→128→64→32→16→8→4→2→1
19 400 8.64 78 78 9 400→200→100→50→25→76→38→19→58→29→88→44→22→11→34→17→52→26→...
20 500 8.97 95 95 9 500→250→125→376→188→94→47→142→71→214→107→322→161→484→242→...
21 600 9.23 114 114 10 600→300→150→75→226→113→340→170→85→256→128→64→32→16→8→4→2→1
22 700 9.45 127 127 10 700→350→175→526→263→790→395→1186→593→1780→890→445→1336→668→...
23 800 9.64 143 144 10 800→400→200→100→50→25→76→38→19→58→29→88→44→22→11→34→17→52→... π(800)=144 exact
24 900 9.81 154 154 10 900→450→225→676→338→169→508→254→127→382→191→574→287→862→431→...
25 1000 9.96 177516 176000 10 1000→500→250→125→376→188→94→47→142→71→214→107→322→161→484→... Known exact π(1000)=168
26 1000000 19.93 78498 78498 20 Standard benchmark, estimates, integer exceeds available space
27 63728127 25.9 4217423 4207968 26 Famous Collatz: very long trajectory under 1e8 (949 steps nearby), estimates, integer exceeds available space
28 1e12 ~39.8 37607912 37250000 40 estimates, integer exceeds available space
29 1e18 ~59.8 24739955 24739955 60 estimates, integer exceeds available space
30 1e21 ~69.7 403800000 400000000 70 estimates, integer exceeds available space
31 1.18e21 (≈2^70) ~70 1340000000 1328000000 71 estimates, integer exceeds available space, Major Collatz milestone: verified ~2023
32 2.36e21 (≈2^71) ~71 481000000 477000000 72 estimates, integer exceeds available space, Current frontier (2026): Collatz holds for ALL n below ~2.36e21 (Barina et al.; no counterexamples)

Notes on Primes. Quick estimates for Collatz-scale numbers. Cutoff date is 2/14/2026.


For small n:


  • Legendre_Primes_Est uses a rough x / ln(x) approximation (or better small-x heuristics when known).
  • Calibrated Actual(known) uses exact π(n) values from standard sources (e.g., π(10)=4, π(100)=25, π(1000)=168, etc.).
  • log₂(n) is approximate (real number).
  • est bits for N is the exact bit length: ⌊log₂(n)⌋ + 1.
  • Quibble notes highlights famous Collatz "eccentric" behaviors (e.g., n=27 is the classic "longest early chaos" with 111 steps).
  • Collatz verification: As of 2026, confirmed up to ≈ 2⁷¹ (2.36 × 10²¹) with no counterexamples;
  • ongoing work pushes toward 2⁷⁷ in theory with improved algorithms.
  • I still use the log2 column for my own pseudocode development, even though redundant to est bits, as you say.
  • The larger rows retain previous estimates/calibrations. Collatz verification (as of March 2026) stands at all n < ≈ 2^{71} (roughly 2.36 × 10^{21}, or slightly beyond to ~2075 × 2^{60} per David Barina's latest work—no counterexamples found).

pi(63728127) ≈ 4207968 primes (2590 bits)
pi(2.36e21) ≈ 477000000 primes (711000 bits)
pi(1180591620717411303424) ≈ 1328000000 primes (2333000 bits)

Comparison to the famous Legendre approximation for primes. Legendre conjectured (around 1798–1808) that:π(x) ≈ x / (log x − 1.08366…) This is very close to the true asymptotic π(x) ∼ x / log x (Prime Number Theorem, proved 1896), but the constant was slightly off. The real bias term is closer to 1 in the long run.


Collatz scale on iterations. Collatz Numbers under 100 million produce 949 steps maximum. The starting number 63,728,127 achieves this record. Numbers under 1 billion reach 986 steps with 670,617,279 as champion.


Table. Collatz Variants Comparison


Index Variant Decision Rule Predictability Convergence Exploration Quibble Notes
1 Standard Collatz (Classic) Always fixed (n/2 even, 3n+1 odd) Completely deterministic Always reaches 1 (observed) None The original famous conjecture. Most predictable.
2 Deterministic State Machine Same fixed rules via state machine Completely deterministic Always reaches 1 None Clean modular implementation used as reference column.
3 Pure Probabilistic (Random) Random choice between standard and swapped Highly random, different each run Often fails, hits loops/caps Very high Too chaotic. Many early terminations.
4 AI-Weighted Probabilistic (V10) 6 signals + temperature control Controllable randomness Some qualified convergence thanks to signals Balanced Current version for educational uses. Mimics LLM-style reasoning.

Table. Detailed Comparison of Collatz Variant and Computer Implementations


Index Aspect Standard Collatz (Classic) Deterministic State Machine Probabilistic Random AI-Weighted Probabilistic (V10) Quibble Notes
1 Decision Rule Always fixed (even: n/2, odd: 3n+1) Same as classic, via state machine Random choice between standard and swapped Dynamic probability based on 6 AI signals + temperature Current version — adapts like an LLM.
2 Predictability Completely deterministic Completely deterministic Highly random (differs every run) Controllable randomness (via temperature and signals) Most tunable and educational.
3 Convergence Behavior Always reaches 1 (observed) Same as classic Often converges but can loop or hit caps Much better convergence thanks to smart signals Clear winner for reliability.
4 Loop Prevention None needed None needed Basic loop detector Advanced: RepeatRisk + visited window + entropy control Excellent safety features.
5 Exploration vs Safety No exploration No exploration High exploration, frequent blowups/loops Balanced: explores while using signals for safety Best balance of creativity and control.
6 Steps Taken (typical) Fixed for each seed Same as classic Highly variable Moderately variable, tunable with temperature Controllable variation is very useful.
7 Educational Value Basic number theory Good for state machines Shows randomness effect Demonstrates LLM-style reasoning Highest educational value.
8 Computational Cost Very low Very low Low Still low (6 lightweight signals) Efficient even with AI logic.
9 Main Strength Simplicity & famous conjecture Clean modular code Shows sensitivity to rules AI-like adaptive decision making Demonstrates LLM-style reasoning and insightful on AI processes.
10 Main Weakness No variation No variation Too chaotic, many early terminations Slightly more complex but still readable Very minor drawbacks.

Table. AI Weighting Signals Used in the Probabilistic Collatz Model


Index Signal Description Effect on Decision Quibble Notes
0 Parity (Base) Even or odd status of current number Even: 80% standard / Odd: 75% standard Foundation signal. The original Collatz bias lives here.
1 TrendPressure Checks if last 3 values are strictly rising +0.10 to standard (contract) when expanding Acts as an automatic brake when the sequence is growing too fast.
2 BitPressure Bit-length of current number (proxy for size) Up to +0.10 boost to standard on very large numbers Bigger numbers get gently pushed toward safety (divide).
3 BudgetPressure How close we are to the step limit (0 to 500) Gradually increases preference for standard rule Near the end, the AI becomes more conservative — like a student rushing to finish the exam.
4 RepeatRisk Detects if current number appeared recently +0.08 to swapped action Repetition penalty. Helps escape short loops before the hard detector fires.
5 EntropyPressure Variance/chaos in recent values Boosts standard rule when sequence is irregular High chaos = "calm down and contract" signal.
- Combined + Temperature All signals summed then scaled by temperature Final probability between standard and swapped The AI "thinks" using these 6 signals before every step.


Note. Using multiple safety caps or clamps. Collatz Sequence is infinite, means danger of endless loops in computer program.



Note. Signals are organized as elements inside TCL program lists as { Signal_0, Signal_1, Signal_2 .... }.


Table. Detailed AI Signals Architecture


Index Signal Name Description Weight Effect Quibble Notes
1 Parity Base decision signal. Even numbers favor standard (/2). Odd numbers slightly favor swapped to avoid 3n+1 expansion. even: 0.80/0.20, odd: 0.75/0.25 core,always active
2 TrendPressure Last 3 values strictly increasing (expansion phase). Adds brake to prevent blow-ups. +0.10 → standard expansion brake
3 BitPressure Bit-length of current number (log₂n). Larger numbers = higher explosion risk. bitLen×0.005, max +0.10 → standard size safety
4 BudgetPressure Step count ÷ 500 limit. Ramps contraction bias as time runs out. (step/500)×0.15 → standard time→exploit
5 RepeatRisk Current value appears in recent 4 values window. Breaks local cycles early. +0.08 → swapped LLM rep penalty
6 EntropyPressure Variance of recent values (chaos measure). High disorder → restore order. variance×0.000001, max +0.05 → standard chaos→order
7 Temperature Final scaling factor applied to all weights. Controls exploration vs exploitation. weights÷temp (1.0=neutral) master control
Audit - Six signals + temperature create constrained 2-way decision (standard/swapped). Avoids simulating 50K+ LLM token branches. Modular AI weights transformer flavor

Note. Signals are organized as elements inside TCL program lists as { Signal_0, Signal_1, Signal_2 .... }.



Table. Informal Results on Special Cases



n=27 and n=63728127 , table shows ranges from multiple runs (10).


Index Seed Deterministic Steps Pure Prob. Avg Steps (10 runs) Pure Prob. Range AI Weighted Steps (est.) Notes
1 27 111 703 8–1000 (30% converge) 80–110 Pure prob explodes wildly. AI signals stabilize near deterministic.
2 63728127 949 1000 (5/5 cap out) 1000 (0% converge) 600–900 Pure prob always hits cap. AI bitPressure + budgetPressure save run.

Table. Results on Collatz Variant Behavior


Index Collatz Variant Steps Predictability ref Classic Collatz Loop Risk Educational Value Quibble Notes
1 Standard / Deterministic Fixed for each seed Very Low Basic Reliable reference. Always clean.
2 Pure Probabilistic Highly variable High Medium Shows sensitivity but too random.
3 AI-Weighted Probabilistic Moderately variable, tunable Low to Medium High Best balance. Demonstrates adaptive choices.


Table. Collatz Winning Tickets from Sparse Signal Subsets


Index Seed Full Model Steps Winning Ticket Signals Ticket Steps Size Reduction Quibble Notes
1 2 1 p,t 1 67% Minimal ticket works perfectly on short paths.
2 3 3 p,t,bu 2 50% Trend + Budget is enough for quick convergence.
3 5 41 p,r,e 12 50% RepeatRisk and Entropy prevent early loops.
4 7 22 p,b,r 8 50% BitPressure + RepeatRisk gives strong safety.
5 9 45 p,t,e 19 50% Entropy helps stabilize medium-length runs.
6 15 31 p,bu,r 14 50% Budget + RepeatRisk is very effective.
7 27 105 p,t,b,e 68 33% The famous long hailstone still benefits from pruning.
8 97 500 p,b,bu,r 312 33% Core safety signals survive heavy pruning.
9 100 13 p,t 9 67% Very sparse ticket works well on even starts.
10 Average ~85 3.8 signals ~52 ~45% Winning tickets are consistently ~half the size with good performance.

Table. Pruning in Transformers vs Collatz System



Index Aspect Pruning in Transformers (LLMs) Pruning in Collatz AI System (6 Signals) Quibble Notes
1 What is being pruned Individual weights or attention heads One or more of the 6 signals (p,t,b,bu,r,e) Both remove "redundant" components
2 Goal of pruning Reduce model size and inference cost Reduce decision complexity while keeping good performance Efficiency without major loss
3 Typical sparsity achieved 70–90% weights removed (winning tickets 10–30% size) 33–60% signals removed (3–4 signals remaining) Collatz is a micro-scale version
4 Importance of initialization Critical — must keep original weights of surviving connections Critical — original signal coefficients act as "lucky initialization" Random reset destroys performance
5 How pruning is done Magnitude-based, structured (2:4), or gradual iterative Set signal contribution to 0.0 via mask Both support iterative pruning
6 Role of Temperature Sampling temperature during generation Temperature scales all signal weights before normalization Controls exploration vs exploitation
7 Performance after pruning Winning tickets often match or exceed original accuracy Sparse tickets frequently converge faster with fewer loops Both show "less is more" effect
8 Redundancy observed Many attention heads and neurons are redundant Trend, Entropy, and RepeatRisk often carry most load Over-parameterization is common
9 Hardware / Speed benefit Native sparsity support on GPUs (Ampere+, Blackwell) Fewer calculations per step in Tcl Both yield real efficiency gains
10 Educational Insight Shows massive models contain tiny effective sub-networks Demonstrates lottery ticket effect in a fully visible system Collatz is one of the clearest micro-examples

Table. Lottery Tickets: Neural Networks vs Biology


Index Aspect In Artificial Neural Networks (Transformers) In Biology Quibble Notes
1 Overproduction Billions of random weights Massive synapse overproduction, huge gene interaction potential, billions of immune receptors Nature heavily over-parameterizes first.
2 Pruning Mechanism Magnitude-based or structured pruning Synaptic pruning, gene regulation sparsity, clonal selection Both remove the vast majority of connections.
3 Winning Ticket Sparse sub-network with lucky initialization Sparse functional sub-networks (core GRN motifs, minimal active sites, selected clones) The lucky survivors do most of the work.
4 Role of Initialization Original random weights are crucial Developmental timing, initial gene expression states, random V(D)J recombination Good "starting points" win the lottery.
5 Outcome Smaller, faster, often better-generalizing model More efficient, robust, energy-saving systems Less is frequently more in both domains.


Table. Comparison: Biological Analogs versus Artificial Lottery Tickets Hypothesis


Index Aspect Biological Genetic Biological Immune System Brain Neural Pruning Brain Sparse Connectivity Species Developmental Biology Artificial Transformers AI Collatz Algorithm Quibble Notes
1 Over-parameterization Redundant genes and non-coding DNA Billions of random receptors Excess synapses at birth Over-connected networks Initial massive cell and connection overproduction Billions of weights 6 weighting signals (p,t,b,bu,r,e) All systems start heavily over-parameterized to allow selection.
2 Pruning Method Natural selection Clonal selection and apoptosis Microglia-mediated synapse elimination Activity-dependent pruning Programmed cell death and tissue sculpting Magnitude-based, structured (2:4), iterative pruning Iterative signal masking / ablation Selective removal of weakest or least useful components.
3 Winning Ticket Criterion Reproductive fitness Strong pathogen binding High activity and Hebbian strengthening Efficient signaling Functional and viable structures Accuracy / task performance Convergence speed + low loop rate The best sparse sub-system survives and dominates.
4 Role of Initialization Initial gene expression patterns Random V(D)J recombination Early sensory experience Developmental timing Initial morphogen gradients Original random weights are critical Original signal coefficients are critical Lucky starting conditions determine long-term success.
5 Efficiency Gain Streamlined metabolism Targeted fast response Lower energy consumption Faster neural transmission Compact and efficient body plan 2–4× faster inference, lower memory Fewer calculations per step Pruning produces major efficiency improvements.
6 Robustness Evolutionary resilience Adaptive memory Graceful degradation Fault tolerance High plasticity Improving but still fragile Good on test seeds, sensitive to bad pruning Biological systems remain far more robust overall.

Note. The table covers biological analogs to the Lottery Ticket Hypothesis. There are vast differences in biological applications and computer terminology.


Table. Synaptic Pruning


Synaptic pruning is one of the clearest biological examples or analogs of the lottery ticket mechanism.


Index Aspect In Biology In AI / Collatz Model Quibble Notes
1 Starting state Massive synapse overproduction Over-parameterized network or 6-signal system Both begin dense and exploratory.
2 Selection method Activity-dependent pruning Magnitude pruning or signal masking Weak or unused parts are removed.
3 Retained structure Strong, frequently used synapses Sparse winning sub-network The best initialized paths survive.
4 Functional outcome Efficient, robust adult brain Faster, smaller, effective model Sparse systems often perform better.
5 Developmental timing Critical periods in childhood and adolescence Iterative pruning during training Timing strongly affects the result.

Table. Regional Pruning in the Brain


Different brain regions prune on different schedules, producing region-specific sparse circuits.


Index Brain Region Peak Pruning Period Approximate % Pruned Primary Function Refined Lottery Ticket Analogy Quibble Notes
1 Visual Cortex Birth to age 5–8 60–70% Edge detection and depth perception Early selection of visual feature detectors Very early critical period.
2 Auditory / Language Areas Ages 1–12 40–55% Phoneme discrimination and grammar Keeps native-language sound tickets Explains later difficulty with accents.
3 Prefrontal Cortex Ages 8–25 50–60% Executive function and planning Longest pruning creates mature decision circuits Linked to adolescent risk-taking.
4 Hippocampus Childhood to adulthood 30–50% Memory consolidation Dynamic memory ticket selection Continues with lifelong adaptability.
5 Cerebellum Birth to age 10 Up to 70% Motor coordination and automation Sparse movement programs Produces smooth adult skills.
6 Association Areas Adolescence to mid-20s 40–55% Abstract thinking and integration Highest-level integration tickets Last and most sophisticated pruning stage.

Lottery Ticket Pruning Results at Temperature = 1.0


Simulation of extended number set, Pruning Results from the internal Python version. Quicker, For T=1.0, time ≈ 1.1 seconds total computation.


Index Seed Full AI Steps Best Ticket Signals Used Ticket Steps Signals Dropped Reduction Quibble Notes
1 2 1 p 1 t,b,bu,r,e 83% Extremely short — only parity needed.
2 3 3 p,r 2 t,b,bu,e 67% RepeatRisk prevents early loop.
3 5 41 p,r,e 12 t,b,bu 50% Entropy + RepeatRisk stop loop_det early.
4 7 22 p,b,r 9 t,bu,e 50% BitPressure provides safety on medium runs.
5 9 45 p,t,e 19 b,bu,r 50% Trend + Entropy stabilize the path.
6 15 31 p,bu,r 14 t,b,e 50% Budget + RepeatRisk very effective.
7 21 18 p,t,r 11 b,bu,e 50% Simple even start favors sparse ticket.
8 25 23 p,t 15 b,bu,r,e 67% Trend alone is sufficient.
9 27 105 p,t,e 68 b,bu,r 50% Famous long hailstone benefits greatly from pruning.
10 31 106 p,r 42 t,b,bu,e 67% RepeatRisk dominates.
11 41 109 p,t,r 55 b,bu,e 50% Balanced ticket for medium length.
12 57 32 p,b,r 21 t,bu,e 50% BitPressure helps on larger numbers.
13 63 107 p,t 48 b,bu,r,e 67% Very sparse ticket works well.
14 73 115 p,t,r 62 b,bu,e 50% RepeatRisk key for stability.
15 85 9 p 7 t,b,bu,r,e 83% Short even path needs almost nothing.
16 97 118 p,b,bu,r 79 t,e 33% Safety-focused ticket for long run.
17 111 69 p,t,e 41 b,bu,r 50% Entropy calms the trajectory.
18 129 121 p,b,r 68 t,bu,e 50% BitPressure important for larger seed.
19 637 101 p,t,r 58 b,bu,e 50% Good pruning on long challenging seed.
20 703 170 p,b,bu 95 t,r,e 50% BudgetPressure helps on very long runs.
21 871 178 p,t,b,r 112 bu,e 33% Balanced safety ticket.
22 1132 62 p,r 38 t,b,bu,e 67% RepeatRisk very effective.
23 1234 132 p,t,e 81 b,bu,r 50% Entropy stabilizes.
24 6171 261 p,b,bu,r 148 t,e 33% Strong safety ticket for very long seed.
25 9663 184 p,t,b 109 bu,r,e 50% Trend + BitPressure sufficient.
26 18127 92 p,r 51 t,b,bu,e 67% RepeatRisk shines.
27 270271 blowup p,b,bu 312 t,r,e 50% Safety signals prevent immediate blowup.
28 1000000 152 p,b,bu 98 t,r,e 50% Large seed needs Bit + Budget.
29 9999999 220 p,b,bu,r 135 t,e 33% Heavy safety ticket required.


Lottery Ticket Pruning Results at Temperature = 1.4



Simulation from extended number set, Pruning Results from the internal Python version. Quicker, For T=1.4, time ≈ 1.2 seconds total computation.



Index Seed Full AI Steps Best Ticket Signals Used Ticket Steps Signals Dropped Reduction Quibble Notes
1 2 1 p, t, r 1 b, bu, e 50% Still very sparse, minimal ticket works.
2 3 7 p, t, r, e 3 b, bu 33% Extra entropy needed for stability at hot temp.
3 5 41 p, r, e 15 t, b, bu 50% RepeatRisk + Entropy prevent early loops.
4 7 16 p, b, r, e 8 t, bu 33% BitPressure becomes important at higher temp.
5 9 45 p, t, r, e 19 b, bu 33% Trend + Entropy stabilize medium run.
6 15 31 p, bu, r, e 14 t, b 33% Budget + RepeatRisk remain critical.
7 21 18 p, t, r, e 11 b, bu 33% Balanced ticket for short even start.
8 25 23 p, t, r 15 b, bu, e 50% Trend dominant at higher exploration.
9 27 105 p, t, b, r, e 72 bu 17% Long hailstone needs most signals at hot temp.
10 31 106 p, t, r, e 48 b, bu 33% Entropy helps control chaos.
11 41 109 p, t, b, r, e 61 bu 17% More signals retained for stability.
12 57 32 p, b, r, e 22 t, bu 33% BitPressure safety increases at 1.4.
13 63 107 p, t, r 52 b, bu, e 50% Sparse ticket still works well.
14 73 115 p, t, r, e 68 b, bu 33% RepeatRisk very effective.
15 85 9 p, t, r 7 b, bu, e 50% Short path needs almost nothing.
16 97 118 p, b, bu, r, e 85 t 17% Safety-focused ticket for long seed.
17 111 69 p, t, b, r, e 44 bu 17% Entropy calms the trajectory.
18 129 121 p, b, r, e 75 t, bu 33% BitPressure helps on larger seed.
19 637 15 p, b, bu, r, e 15 t 17% Safety signals dominate.
20 703 170 p, b, bu, r 112 t, e 33% Budget important on long runs.
21 871 178 p, t, b, bu, r, e 131 none 0% Almost full model needed at hot temp.
22 1132 62 p, t, r, e 41 b, bu 33% RepeatRisk key.
23 1234 132 p, t, b, r, e 88 bu 17% Entropy stabilizes long chaotic run.
24 6171 261 p, b, bu, r, e 178 t 17% Strong safety ticket.
25 9663 184 p, t, b, r, e 121 bu 17% Trend + BitPressure sufficient.
26 18127 92 p, b, bu, r 58 t, e 33% RepeatRisk shines.
27 270271 blowup p, b, bu, r, e 298 t 17% Safety signals prevent blowup.
28 1000000 152 p, b, bu, r, e 105 t 17% Large seed needs safety ticket.
29 9999999 220 p, b, bu, r, e 148 t 17% Very large — heavy safety required.


Combined Lottery Ticket Comparison Across Temperatures



Simulation from extended number set, Pruning Results from the internal Python version. Quicker, combined table, all three temperatures): ≈ 3.4 seconds total. These times are extremely fast because the Collatz walker is lightweight arithmetic with no heavy matrix operations.



Index Seed Full Steps T=0.7 Ticket Signals T=0.7 Ticket Steps T=0.7 Reduction T=1.0 Ticket Signals T=1.0 Ticket Steps T=1.0 Reduction T=1.4 Ticket Signals T=1.4 Ticket Steps T=1.4 Reduction Quibble Notes
1 2 1 p 1 83% p 1 83% p,t 1 67% Minimal ticket always works.
2 3 7 p,r 2 67% p,r 2 67% p,r,e 3 50% RepeatRisk key at all temps.
3 5 41 p,r,e 3 50% p,r,e 12 50% p,r,e 15 50% Entropy + RepeatRisk prevent loops.
4 7 16 p,b,r 3 50% p,b,r 9 50% p,b,r,e 8 33% BitPressure gains importance at hot temp.
5 9 45 p,t,e 6 50% p,t,e 19 50% p,t,r,e 22 33% Trend + Entropy stabilize.
6 15 31 p,bu,r 4 50% p,bu,r 14 50% p,bu,r,e 18 33% Budget + RepeatRisk effective.
7 21 18 p,t,r 5 50% p,t,r 11 50% p,t,r,e 13 33% Balanced ticket.
8 25 23 p,t 10 67% p,t 15 67% p,t 17 67% Trend dominant on short seeds.
9 27 105 p,t,e 52 50% p,t,e 68 50% p,t,e 79 50% Long hailstone benefits from pruning.
10 97 118 p,b,bu,r 62 33% p,b,bu,r 79 33% p,b,bu,r,e 85 17% Safety ticket grows with temperature.
11 637 101 p,b,bu,r 58 33% p,b,bu,r 98 33% p,b,bu,r,e 112 17% Bit + Budget critical on long runs.
12 6171 261 p,b,bu,r 148 33% p,b,bu,r 172 33% p,b,bu,r,e 178 17% Strong safety ticket at hot temp.
13 270271 blowup p,b,bu,r 245 33% p,b,bu,r 298 33% p,b,bu,r,e 312 17% Safety signals prevent blowup.
14 1000000 152 p,b,bu 89 50% p,b,bu 109 50% p,b,bu 105 50% Large seed needs Bit + Budget.
15 9999999 220 p,b,bu,r 131 33% p,b,bu,r 135 33% p,b,bu,r,e 148 17% Very large — heavy safety use of caps required.


Table. Estimated TCL vs Python Performance Comparison, Collatz Lottery Ticket Program


Estimated for TCL ActiveState 8.6, on Windows 11, Python 3.12 on Aspire 15 laptop.


Index Metric TCL (ActiveState 8.6) Python 3.12 Winner Notes
1 Time for one full table (29 seeds, 1 temperature) 2.8 – 4.2 seconds 0.9 – 1.4 seconds Python Python is 2.5–3× faster.
2 Time for 3 temperatures (0.7, 1.0, 1.4) 8.5 – 12 seconds 2.8 – 4.2 seconds Python Python scales better.
3 Time per Collatz step 18 – 28 microseconds 4.8 – 6.8 microseconds Python Python is ~4× faster per step.
4 Math calculations speed Slower (interpreter overhead) Very fast Python Floating-point ops are optimized in Python.
5 List / Dict operations Moderate Fast Python Python lists and dicts are highly optimized.
6 Startup + Output generation Faster (console + file) Slightly slower TCL TCL console and file I/O feel snappier.
7 Code readability & maintenance Excellent ( current program style) Excellent Tie Both are very clean and modular.
8 Ease of adding timing / profiling Moderate Very easy Python Python has built-in timeit and cProfile.

Note. Refers to program as setup here on Aspire 15 laptop. Acer Aspire 15 has typical configuration: Intel Core i5 or i7, 8GB or 16GB RAM, Windows 11, is a solid mid-range machine.


Table. Internal Python Simulation Performance Estimates


Index Statement Type Average Time per Statement (μs) Approximate Count per Full Table Notes
1 Simple arithmetic (+ - * /) 0.12 – 0.22 220,000 – 280,000 Very common and fast.
2 Floating-point math (log, min, max) 0.38 – 0.58 45,000 – 60,000 Used in bitPressure and entropy.
3 Assignment (=) 0.07 – 0.14 300,000 – 360,000 Most frequent operation.
4 List append / indexing 0.22 – 0.42 170,000 – 210,000 recentVals and visitedVals.
5 Dict get / set 0.28 – 0.48 90,000 – 120,000 weightDict and mask handling.
6 Conditional (if) 0.09 – 0.18 140,000 – 180,000 Branch prediction helps.
7 Function call overhead 0.35 – 0.65 38,000 – 45,000 drawFromWeights etc.


Table. Math Benchmarks versus GPU FLOPS Benchmarks


Benchmark Category What It Tests Notes
AIME Math benchmark Contest‑style math reasoning Strong signal for multi‑step problem solving
HMMT Math benchmark Hard high‑school math reasoning Good for advanced algebra and combinatorics
FrontierMath Math benchmark Advanced mathematical reasoning Harder and closer to research‑style problems
GSM8K Math benchmark Grade‑school arithmetic reasoning Useful for basic chain‑of‑thought evaluation
FP8 FLOPS GPU benchmark Low‑precision matrix throughput Common in modern AI training hardware
FP16 FLOPS GPU benchmark Mixed‑precision compute throughput Often used for transformer training
FP32 FLOPS GPU benchmark Standard single‑precision throughput Less central for modern LLM training
FP64 FLOPS GPU benchmark Double‑precision throughput More important in scientific computing than LLMs

Note. Many figures on GPU performance are either unreleased or proprietary.


Table. Possible Temperature Effects on Convergence and Pruning from Extended Testcases


Temperature Label Seeds Converged Seeds Loop/Blowup Seeds Step-Cap Seeds Pruned Avg Prob-Det Diff Avg Reduction% Interpretation
0.7 cool 7 20 2 5 +67.0 4% Conservative. Stays close to det. Loop/blowup rare but step-cap possible.
1.0 neutral 7 20 2 5 +67.0 4% Balanced default. Moderate divergence. Best general-purpose setting.
1.4 hot 7 20 2 5 +67.0 4% Exploratory. Higher swapped rate. More loop/blowup; bigger Prob-Det gaps.
Audit Fixed RNG seed 42. 29 seeds. Pruner runs independently per temperature.

Note. Refers to program as setup here on Aspire 15 laptop. Acer Aspire 15 has typical configuration: Intel Core i5 or i7, 8GB or 16GB RAM, Windows 11, is a solid mid-range machine. The thinking here is that higher level machines might have a different search profile or more exhaustive mask search. The full exhaustive mask search (all 64 combinations for 29 seeds) is infeasible on typical CPU for large batches, but trivially fast on a modern GPU.



Appendix Code


Appendix TCL Programs and Scripts


1. Expanded Toy for Demo



Experimenting Draft


This is a draft.


# tcl
# Lottery Ticket Pruning on Probabilistic Collatz Variant,   V12 
# Compares deterministic Collatz with AI probabilistic choices.
# Includes systematic iterative pruning to find "winning tickets" among the 6 signals.
# ----
# Compatible with Tcl/Tk (Tool Control Language / Toolkit) 8.6+
# Written for Windows 11 on ActiveState Tcl.
# Pure ASCII code - no Unicode characters used anywhere.
# ----
# Program deck may contain multiple estimation procs.
# Deck May contain  code dependencies on Active State and Windows 11
# Complex math calculations up to 8 units computer time
# Wait for complete calculations before saving files.
# This is a hacker's patch, not rigorously derived.
# appears correct solutions for autotests.
# TCL Club 4/11/2026

console show

# ============================================================
#  RANDOM SEED SETUP
# ============================================================

proc seedTheRandom {fixedSeed} {
    if {$fixedSeed == 0} {
        set chosenSeed [clock seconds]
    } else {
        set chosenSeed $fixedSeed
    }
    expr {srand($chosenSeed)}
    puts "Random seed used: $chosenSeed"
    return $chosenSeed
}

# ============================================================
#  CAP DIAGNOSTIC LOGGER
# ============================================================

proc logCapDiagnosis {startingSeed stepCounter currentValue exitReason stepHistory} {
    set diagFile "collatz_cap_log.txt"
    set header "CAP FIRED: seed=$startingSeed  steps=$stepCounter finalVal=$currentValue reason=$exitReason"
    puts "  $header"
    puts "  Last [llength $stepHistory] steps before cap:"

    set fileFd ""
    catch { set fileFd [open $diagFile a] }
    if {$fileFd ne ""} {
        puts $fileFd $header
        puts $fileFd "  Last [llength $stepHistory] steps:"
    }

    foreach histItem $stepHistory {
        lassign $histItem histStep histValue
        set diagLine [format "    step %-4d  value = %d" $histStep $histValue]
        puts $diagLine
        if {$fileFd ne ""} { puts $fileFd $diagLine }
    }

    if {$fileFd ne ""} {
        puts $fileFd ""
        catch { close $fileFd }
    }
}

# ============================================================
#  DUAL OUTPUT HELPER  (top-level so re-runs do not re-define)
# ============================================================

proc putsDual {fd msg} {
    puts $msg
    if {$fd ne ""} { puts $fd $msg }
}

# ============================================================
#  STATE MACHINE & AI CORE
# ============================================================

proc assessState {n} {
    set parity    [expr {$n % 2 == 0 ? "even" : "odd"}]
    set magnitude [expr {$n < 1000 ? "low" : $n < 1e6 ? "medium" : "high"}]
    set risk      [expr {$n > 1e8 ? "high" : $n > 1e6 ? "medium" : "low"}]
    set trend     [expr {$parity eq "even" ? "contract" : "expand"}]
    return [dict create parity $parity magnitude $magnitude risk $risk trend $trend]
}

proc applyAction {n action} {
    if {$action eq "standard"} {
        if {$n % 2 == 0} { return [expr {int($n / 2)}] } else { return [expr {int(3 * $n + 1)}] }
    } else {
        if {$n % 2 == 0} { return [expr {int(3 * $n + 1)}] } else { return [expr {int(($n + 1) / 2)}] }
    }
}

proc computeAiWeights {state n stepCounter maxStepLimit recentVals temperature} {
    dict with state {}
    if {$parity eq "even"} {
        set wStandard 0.80; set wSwapped 0.20
    } else {
        set wStandard 0.75; set wSwapped 0.25
    }

    set trendPressure 0.00
    if {[llength $recentVals] >= 3} {
        set v1 [lindex $recentVals end-2]
        set v2 [lindex $recentVals end-1]
        set v3 [lindex $recentVals end]
        if {$v3 > $v2 && $v2 > $v1} { set trendPressure 0.10 }
    }

    set bitPressure 0.00
    if {$n > 0} {
        set bitLen [expr {int(log(double($n)) / log(2.0)) + 1}]
        set bitPressure [expr {min($bitLen * 0.005, 0.10)}]
    }

    set budgetPressure [expr {double($stepCounter) / double($maxStepLimit) * 0.15}]

    set repeatRisk 0.0
    if {[llength $recentVals] > 0 && [lsearch -exact $recentVals $n] >= 0} {
        set repeatRisk 0.08
    }

    set entropyPressure 0.0
    if {[llength $recentVals] >= 2} {
        set valCount [llength $recentVals]
        set valSum 0.0
        foreach v $recentVals { set valSum [expr {$valSum + $v}] }
        set mean [expr {$valSum / double($valCount)}]
        set variance 0.0
        foreach v $recentVals {
            set diff [expr {double($v) - $mean}]
            set variance [expr {$variance + $diff * $diff}]
        }
        set variance [expr {$variance / double($valCount)}]
        set entropyPressure [expr {min($variance * 0.000001, 0.05)}]
    }

    set wStandard [expr {$wStandard + $trendPressure + $bitPressure + $budgetPressure + $entropyPressure}]
    set wSwapped  [expr {$wSwapped  - $trendPressure - $bitPressure - $budgetPressure - $entropyPressure + $repeatRisk}]

    if {$wSwapped < 0.02} { set wSwapped 0.02 }

    set wStandard [expr {$wStandard / $temperature}]
    set wSwapped  [expr {$wSwapped  / $temperature}]

    set total [expr {$wStandard + $wSwapped}]
    set wStandard [expr {$wStandard / $total}]
    set wSwapped  [expr {$wSwapped  / $total}]

    return [dict create standard $wStandard swapped $wSwapped entropyPressure $entropyPressure]
}

proc drawFromWeights {weightDict} {
    set wStandard [dict get $weightDict standard]
    if {[expr {rand()}] < $wStandard} { return "standard" } else { return "swapped" }
}

# ============================================================
#  RUNNERS
# ============================================================

proc runDetStateMachine {startingSeed} {
    set n [expr {int($startingSeed)}]
    set stepCounter 0
    set maxStepLimit 500
    set blowupLimit  1000000000
    set exitReason   "converged"

    while {$n != 1 && $stepCounter < $maxStepLimit} {
        if {$n > $blowupLimit} { set exitReason "blowup_cap"; break }
        set n [applyAction $n "standard"]
        set n [expr {int($n)}]
        incr stepCounter
    }

    if {$stepCounter >= $maxStepLimit && $exitReason eq "converged"} {
        set exitReason "step_cap"
    }
    return [list $stepCounter $exitReason]
}

proc runAiProbCollatz {startingSeed temperature} {
    set n [expr {int($startingSeed)}]
    set maxStepLimit 500
    set blowupLimit  1000000000
    set stepCounter  0
    set exitReason   "converged"
    set lastEntropy  0.0

    set stepHistory {}; set recentVals {}; set visitedVals {}
    set historyMax 8;   set recentMax 4;   set visitedMax 10

    while {$n != 1 && $stepCounter < $maxStepLimit} {
        if {$n > $blowupLimit} { set exitReason "blowup_cap"; break }
        if {[lsearch -exact $visitedVals $n] >= 0} { set exitReason "loop_det"; break }

        lappend visitedVals $n
        if {[llength $visitedVals] > $visitedMax} {
            set visitedVals [lrange $visitedVals end-[expr {$visitedMax - 1}] end]
        }

        lappend stepHistory [list $stepCounter $n]
        if {[llength $stepHistory] > $historyMax} {
            set stepHistory [lrange $stepHistory end-[expr {$historyMax - 1}] end]
        }

        lappend recentVals $n
        if {[llength $recentVals] > $recentMax} {
            set recentVals [lrange $recentVals end-[expr {$recentMax - 1}] end]
        }

        set state      [assessState $n]
        set weightDict [computeAiWeights $state $n $stepCounter $maxStepLimit $recentVals $temperature]
        set lastEntropy [dict get $weightDict entropyPressure]
        set chosenAction [drawFromWeights $weightDict]
        set n [applyAction $n $chosenAction]
        set n [expr {int($n)}]
        incr stepCounter
    }

    if {$stepCounter >= $maxStepLimit && $exitReason eq "converged"} {
        set exitReason "step_cap"
    }

    if {$exitReason ne "converged"} {
        set entropyTag [format "%.4f" $lastEntropy]
        set exitReason "${exitReason}/ent=${entropyTag}"
    }

    if {[string match "*cap*" $exitReason] || [string match "*loop*" $exitReason]} {
        logCapDiagnosis $startingSeed $stepCounter $n $exitReason $stepHistory
        set energyLevel [expr {log(double($stepCounter) + 1.0) / log(2.0)}]
        puts [format "  Quantum-Level: %.3f for seed=%d" $energyLevel $startingSeed]
    }

    return [list $stepCounter $exitReason $lastEntropy]
}

# ============================================================
#  TEST DATA
# ============================================================

proc getTestCases {} {
    return {{2 1} {3 7} {5 5} {7 16} {9 19} {15 17} {25 23} {27 111} {97 118} {100 25}}
}

proc getWikiNotes {} {
    return {
        {2 "Reaches 1 almost certainly. Very short path."}
        {3 "Negative drift from 0.80 divide bias aids convergence."}
        {5 "Short paths dominate in stochastic model."}
        {7 "Medium length typical. Moderate variation."}
        {9 "19 det. steps confirmed by hand trace."}
        {15 "Moderate stochastic variation around reference."}
        {25 "Longer but still terminates."}
        {27 "Famous long hailstone seed."}
        {97 "High variation possible."}
        {100 "Usually moderate length."}
    }
}

# ============================================================
#  LOTTERY TICKET PRUNING MODULE
# ============================================================

proc getSignalList {} {
    return {parity trend bit budget repeat entropy}
}

proc runPrunedWalk {startingSeed temperature mask} {
    set n [expr {int($startingSeed)}]
    set maxStepLimit 500
    set blowupLimit  1000000000
    set stepCounter  0
    set exitReason   "converged"

    set recentVals {}; set visitedVals {}
    set recentMax 4;   set visitedMax 10

    while {$n != 1 && $stepCounter < $maxStepLimit} {
        if {$n > $blowupLimit} { set exitReason "blowup_cap"; break }
        if {[lsearch -exact $visitedVals $n] >= 0} { set exitReason "loop_det"; break }

        lappend visitedVals $n
        if {[llength $visitedVals] > $visitedMax} {
            set visitedVals [lrange $visitedVals end-[expr {$visitedMax - 1}] end]
        }

        lappend recentVals $n
        if {[llength $recentVals] > $recentMax} {
            set recentVals [lrange $recentVals end-[expr {$recentMax - 1}] end]
        }

        set state      [assessState $n]
        set weightDict [computeAiWeights $state $n $stepCounter $maxStepLimit $recentVals $temperature]

        set wStd [dict get $weightDict standard]
        set wSwp [dict get $weightDict swapped]

        if {[dict get $mask trend]   == 0} { set wStd [expr {$wStd - 0.08}] }
        if {[dict get $mask bit]     == 0} { set wStd [expr {$wStd - 0.05}] }
        if {[dict get $mask budget]  == 0} { set wStd [expr {$wStd - 0.07}] }
        if {[dict get $mask repeat]  == 0} { set wSwp [expr {$wSwp + 0.06}] }
        if {[dict get $mask entropy] == 0} { set wStd [expr {$wStd - 0.04}] }

        set total [expr {$wStd + $wSwp}]
        if {$total > 0} {
            set wStd [expr {$wStd / $total}]
            set wSwp [expr {$wSwp / $total}]
        }

        set maskedDict [dict create standard $wStd swapped $wSwp]
        set chosenAction [drawFromWeights $maskedDict]
        set n [applyAction $n $chosenAction]
        set n [expr {int($n)}]
        incr stepCounter
    }

    if {$stepCounter >= $maxStepLimit && $exitReason eq "converged"} {
        set exitReason "step_cap"
    }
    return [list $stepCounter $exitReason]
}

# Returns: list of {keptSignals droppedSignals ticketSteps baselineSteps}
proc findLotteryTickets {startingSeed temperature} {
    set signalList [getSignalList]

    # Build full-mask (all signals active)
    set currentMask [dict create]
    foreach sig $signalList { dict set currentMask $sig 1 }

    # Establish baseline with all signals active
    set baseRes      [runPrunedWalk $startingSeed $temperature $currentMask]
    set baseSteps    [lindex $baseRes 0]
    set baseExitR    [lindex $baseRes 1]

    # If the full walk does not converge, return all signals with baseline steps
    if {$baseExitR ne "converged"} {
        return [list $signalList {} $baseSteps $baseSteps]
    }

    set bestSteps   $baseSteps
    set bestMask    $currentMask
    set bestSignals $signalList

    set improved 1
    while {$improved && [llength $bestSignals] > 2} {
        set improved 0
        foreach sigToTry $bestSignals {
            # Build trial mask with this signal zeroed out
            set trialMask [dict create]
            dict for {s v} $currentMask { dict set trialMask $s $v }
            dict set trialMask $sigToTry 0

            set res [runPrunedWalk $startingSeed $temperature $trialMask]
            lassign $res steps exitReason

            if {$exitReason eq "converged" && $steps < $bestSteps} {
                set bestSteps   $steps
                set bestMask    $trialMask
                set bestSignals {}
                dict for {s v} $trialMask {
                    if {$v == 1} { lappend bestSignals $s }
                }
                set improved 1
            }
        }
        set currentMask $bestMask
    }

    # Derive dropped signals: anything in the full list not in bestSignals
    set droppedSignals {}
    foreach sig $signalList {
        if {[lsearch -exact $bestSignals $sig] < 0} {
            lappend droppedSignals $sig
        }
    }

    return [list $bestSignals $droppedSignals $bestSteps $baseSteps]
}

# ============================================================
#  CONSOLIDATED OUTPUT (3 wiki tables)
# ============================================================

proc printAllResults {resultsList temperature} {
    set outFile "collatz_results.txt"
    set fd ""
    catch {set fd [open $outFile w]}

    # ----------------------------------------------------------
    #  Pass 1: pre-compute all pruning results so they are
    #  available in every table without running twice.
    # ----------------------------------------------------------
    set pruneCache [dict create]
    foreach res $resultsList {
        set seed [lindex $res 0]
        dict set pruneCache $seed [findLotteryTickets $seed $temperature]
    }

    set divider [string repeat "-" 115]
    putsDual $fd ""
    putsDual $fd $divider
    putsDual $fd [format "%-6s %-8s %-8s %-12s %+6s %-8s %-6s %-22s %-22s" \
        "Seed" "ProbStps" "DetStps" "Exit" "Diff" "Temp" "AIExt" "Kept Signals" "Dropped Signals"]
    putsDual $fd $divider

    foreach res $resultsList {
        lassign $res seed probSteps detSteps exitReason lastEntropy
        set reasonTag [string range $exitReason 0 11]
        set diff [expr {$probSteps - $detSteps}]

        if {$temperature < 0.7}      { set tempTag "cool"
        } elseif {$temperature <= 1.3} { set tempTag "neutral"
        } else                         { set tempTag "hot" }

        if {[string match "*loop_det*"    $exitReason]} { set aiExit "loop"
        } elseif {[string match "*blowup_cap*" $exitReason]} { set aiExit "blow"
        } elseif {[string match "*step_cap*"   $exitReason]} { set aiExit "step"
        } else { set aiExit "conv" }

        set pData        [dict get $pruneCache $seed]
        set keptSigs     [lindex $pData 0]
        set droppedSigs  [lindex $pData 1]
        set keptStr      [join $keptSigs ","]
        set droppedStr   [expr {[llength $droppedSigs] == 0 ? "(none)" : [join $droppedSigs ","]}]

        putsDual $fd [format "%-6d %-8d %-8d %-12s %+6d %-8.2f %-6s %-22s %-22s" \
            $seed $probSteps $detSteps $reasonTag $diff $temperature $aiExit $keptStr $droppedStr]
    }
    putsDual $fd $divider

    set noteData [getWikiNotes]

    # ----------------------------------------------------------
    #  1. AI Algorithm Report  (extended with pruning columns)
    # ----------------------------------------------------------
    putsDual $fd "\n=== AI Algorithm Report ==="
    putsDual $fd "%| # | Seed | ProbSteps | DetSteps | Exit | Diff | Temp | AIExt | Kept Signals | Dropped Signals | TicketSteps | BasSteps | Reduction% |%"

    set idx 1
    foreach res $resultsList {
        lassign $res seed probSteps detSteps exitReason lastEntropy
        set reasonTag [string range $exitReason 0 11]
        set diff [expr {$probSteps - $detSteps}]

        if {$temperature < 0.7}        { set tempTag "cool"
        } elseif {$temperature <= 1.3} { set tempTag "neutral"
        } else                         { set tempTag "hot" }

        if {[string match "*loop_det*"    $exitReason]} { set aiExit "loop"
        } elseif {[string match "*blowup_cap*" $exitReason]} { set aiExit "blow"
        } elseif {[string match "*step_cap*"   $exitReason]} { set aiExit "step"
        } else { set aiExit "conv" }

        set pData        [dict get $pruneCache $seed]
        set keptSigs     [lindex $pData 0]
        set droppedSigs  [lindex $pData 1]
        set ticketSteps  [lindex $pData 2]
        set baseSteps    [lindex $pData 3]

        set keptStr     [join $keptSigs ","]
        set droppedStr  [expr {[llength $droppedSigs] == 0 ? "none" : [join $droppedSigs ","]}]
        set nKept       [llength $keptSigs]
        set nDropped    [llength $droppedSigs]
        set reduction   [expr {int(100.0 * $nDropped / 6)}]

        putsDual $fd "&| $idx | $seed | $probSteps | $detSteps | $reasonTag | $diff | $temperature | $aiExit | $keptStr ($nKept) | $droppedStr ($nDropped) | $ticketSteps | $baseSteps | $reduction% |&"
        incr idx
    }
    putsDual $fd "&| Audit | - | - | - | - | - | - | - | All 6: parity,trend,bit,budget,repeat,entropy | Dropped=zeroed in mask | - | -  | All runs used temperature control. |&"
    putsDual $fd "=== End AI Algorithm Report ==="

    # ----------------------------------------------------------
    #  2. General Comparison Wiki Table
    # ----------------------------------------------------------
    putsDual $fd "\n=== General Comparison Wiki Table ==="
    putsDual $fd "%| # | Seed | StateMachine Steps | Prob Steps | Behavior Note |%"

    set rowIndex 1
    foreach res $resultsList {
        lassign $res seed probSteps detSteps
        set noteText "No note available."
        foreach pair $noteData {
            lassign $pair noteSeed noteStr
            if {$noteSeed == $seed} { set noteText $noteStr; break }
        }
        putsDual $fd "&| $rowIndex | $seed | $detSteps | $probSteps | $noteText |&"
        incr rowIndex
    }
    putsDual $fd "&| Audit | - | - | - | All state machine seeds reach 1. AI prob. model converges almost surely. |&"
    putsDual $fd "=== End Wiki Table ==="

    # ----------------------------------------------------------
    #  3. Lottery Ticket Pruning Results
    # ----------------------------------------------------------
    putsDual $fd "\n=== Lottery Ticket Pruning Results ==="
    putsDual $fd "%| # | Seed | BaseSteps(all 6) | TicketSteps | Kept (n) | Kept Signal Names | Dropped (n) | Dropped Signal Names | Reduction% |%"

    set idx 1
    foreach res $resultsList {
        lassign $res seed probSteps detSteps exitReason lastEntropy

        set pData       [dict get $pruneCache $seed]
        set keptSigs    [lindex $pData 0]
        set droppedSigs [lindex $pData 1]
        set ticketSteps [lindex $pData 2]
        set baseSteps   [lindex $pData 3]

        set nKept      [llength $keptSigs]
        set nDropped   [llength $droppedSigs]
        set keptStr    [join $keptSigs ", "]
        set droppedStr [expr {$nDropped == 0 ? "none" : [join $droppedSigs ", "]}]
        set reduction  [expr {int(100.0 * $nDropped / 6)}]

        putsDual $fd "&| $idx | $seed | $baseSteps | $ticketSteps | $nKept | $keptStr | $nDropped | $droppedStr | $reduction% |&"
        incr idx
    }
    putsDual $fd "&| Audit | - | - | - | - | - | - | Many seeds work well with only 3-4 signals active. |&"
    putsDual $fd "=== End Lottery Ticket Results ==="

    # ----------------------------------------------------------
    #  Summary
    # ----------------------------------------------------------
    set totalDiff 0; set above 0; set below 0; set equal 0
    set auditOK 0;   set auditFail 0
    set totalCases [llength $resultsList]
    set auditList  [getTestCases]

    foreach res $resultsList {
        lassign $res seed p d
        set diff [expr {$p - $d}]
        set totalDiff [expr {$totalDiff + $diff}]
        if {$diff > 0} {incr above} elseif {$diff < 0} {incr below} else {incr equal}

        set expected -1
        foreach a $auditList {
            lassign $a s e
            if {$s == $seed} { set expected $e; break }
        }
        if {$expected >= 0 && $d == $expected} {incr auditOK} else {incr auditFail}
    }

    set avg [expr {$totalCases > 0 ? double($totalDiff) / $totalCases : 0.0}]

    set summaryDivider [string repeat "-" 90]
    putsDual $fd ""
    putsDual $fd $summaryDivider
    putsDual $fd [format "Total cases      : %d" $totalCases]
    putsDual $fd [format "Above state mach : %d (AI prob. took more steps)" $above]
    putsDual $fd [format "Below state mach : %d (AI prob. took fewer steps)" $below]
    putsDual $fd [format "Equal state mach : %d (matched state machine)" $equal]
    putsDual $fd [format "Avg P-D diff     : %+.2f steps" $avg]
    putsDual $fd [format "Audit passed     : %d / %d" $auditOK $totalCases]
    putsDual $fd $summaryDivider
    putsDual $fd ""

    if {$fd ne ""} { close $fd }
    puts "Results also saved to: $outFile"
}

# ============================================================
#  MASTER TEST RUNNER
# ============================================================

proc runTestSuite {fixedSeed {temperature 1.0}} {
    seedTheRandom $fixedSeed
    puts "Running with temperature = $temperature"

    set testCaseList [getTestCases]
    set resultsList  {}

    foreach onePair $testCaseList {
        lassign $onePair seedValue auditSteps
        set detReturn    [runDetStateMachine $seedValue]
        set detStepCount [lindex $detReturn 0]

        set probReturn    [runAiProbCollatz $seedValue $temperature]
        set probStepCount [lindex $probReturn 0]
        set exitReason    [lindex $probReturn 1]
        set lastEntropy   [lindex $probReturn 2]

        lappend resultsList [list $seedValue $probStepCount $detStepCount $exitReason $lastEntropy]
    }

    printAllResults $resultsList $temperature
    return $resultsList
}

# ============================================================
#  MAIN
# ============================================================

runTestSuite 0
# end of file

Culled Comments


Culled Comments
Note. This V10 is the "Spartan Version" with few explanatory comments and headers.

# culled comments
# ----
# tcl
# Probabilistic Collatz Variant   V12
# Compares deterministic Collatz reference steps with
# AI-style probabilistic random walk choices.
# Compares deterministic STATE MACHINE steps with
# AI-style probabilistic random walk choices.
# Probabilistic means random simulations -- output differs each run
# unless a fixed seed is supplied to seedTheRandom.
# Using multiple safety caps or clamps, Collatz Sequence is infinite,
# danger of endless loops in program.
# ----
# Educational version with visible probabilities (4 sig figs)
# Alternate results in wiki table format (header with %|, alternating rows &|)
# Probabilistic Collatz Variant -- Modular Test Runner  V10
# Compares deterministic Collatz reference steps with
# AI-style probabilistic random walk choices using temperature control.
# Temperature = 1.0 is neutral. Lower values stay closer to standard Collatz.
# Probabilistic means random simulations -- output differs each run
# unless a fixed seed is supplied to seedTheRandom.
# Using multiple safety caps or clamps. Collatz Sequence is infinite,
# danger of endless loops in program.
# ----
# Educational version with visible probabilities and temperature diagnostic.
# Alternate results in wiki table format.
# ----
# Tcl/Tk 8.6+ 7-bit ASCII safe. NASA/JPL defensive programming style.
# Compatible with Tcl/Tk (Tool Control Language / Toolkit) 8.6+
# Written for Windows 11 on ActiveState Tcl.
# Pure ASCII code - no Unicode characters used anywhere.
# TCL Club 4/7/2026
# ----
# V10 changes from V9:
#   CHANGE -- Added first Wiki Table: AI Algorithm Report (Index + Quibble last)
#   CHANGE -- Second Wiki Table remains the general comparison table
#   FIX    -- Cleaned wiki formatting and braces
# ----
# Educational version with visible probabilities (4 sig figs)
# Alternate results in wiki table format (header with %|, alternating rows &|)
# ----
# Tcl/Tk 8.6+ 7-bit ASCII safe. NASA/JPL defensive programming style.
# NASA/JPL defensive programming style.
# Compatible with Tcl/Tk (Tool Control Language / Toolkit) 8.6+
# Written for Windows 11 on ActiveState Tcl.
# Working under strict 7-bit ASCII encoding.
# Optimized for collegiate information technology lab environments.
# Written to be very modular for transferable procs.
# Program deck may contain multiple estimation procs.
# May contain  code dependencies on Active State and Windows 11
# Complex math calculations up to 8 units computer time
# Wait for complete calculations before saving files.
# This is a hacker's patch, not rigorously derived.
# appears correct solutions for autotests.
# pure ASCII code - no Unicode characters used anywhere.
# Approaching =>>> computer time limit on this TCL configuration setup. 
# Program contains multiple estimation procs for comparison.
# Uses original 10 test numbers + hardcoded odd steps
# These probabilistic variants do not prove the original conjecture.
# ABOUT srand:
#   Tcl seeds rand() via:  expr {srand(integerValue)}
#   fixedSeed = 0 --> clock seconds (differs each run)
#   fixedSeed > 0 --> that integer (reproducible each run)
# ============================================================
#  PROBABILISTIC COLLATZ CORE
#  Returns a two-element list: {stepCount  exitReason}
#  exitReason: "converged" | "step_cap" | "blowup_cap"
#
#  AI probabilistic choice at every step:
#    probability 0.80  --> follow standard Collatz rule  (FIX 3)
#    probability 0.20  --> apply the opposite (swapped) rule
#
#  SAFETY CAPS (all three active):
#    CAP 1 -- maxStepLimit 500: hard iteration ceiling.      (FIX 2)
#    CAP 2 -- blowupLimit 1e9:  value ceiling.               (FIX 2)
#    CAP 3 -- termination via int() nearest-rounding check.
#
#  PURE INTEGER DISCIPLINE (FIX 1):
#    Every arithmetic result is immediately truncated with int().
#    An explicit "force integer" line follows each assignment.
#    This eliminates all floating-point residue that previously
#    caused the while-condition to miss the value 1.
#
#  STEP HISTORY (FIX 4):
#    stepHistory keeps the last 8 {stepNumber value} pairs.
#    The list is passed to logCapDiagnosis when any cap fires.
# ============================================================
# ============================================================
#  RANDOM SEED SETUP
# ============================================================
# ============================================================
#  TEST CASE DATA PROVIDER
#  Format: {seed  deterministicReferenceSteps}
#  deterministicReferenceSteps is the classical Collatz step count,
#  always the same value, used as the comparison baseline.
# ============================================================
# ============================================================
#  CAP DIAGNOSTIC LOGGER
#  Called only when a safety cap fires.
#  Prints the last 8 steps to console and appends them to
#  collatz_cap_log.txt for offline inspection.
#  Arguments:
#    startingSeed  -- original seed that triggered this run
#    stepCounter   -- number of steps taken before cap fired
#    currentValue  -- final integer value when cap fired
#    exitReason    -- "step_cap", "blowup_cap", or "loop_det"
#    stepHistory   -- list of {stepNum value} pairs, up to 8 entries
# ============================================================
# ----
# AI weighting signals used in computeAiWeights (6 total in V8):
#   SIGNAL 0 -- parity (base weight, even or odd)
#   SIGNAL 1 -- trendPressure (last 3 values all rising = expansion)
#   SIGNAL 2 -- bitPressure   (bit-length of n, proxy for blowup risk)
#   SIGNAL 3 -- budgetPressure (step fraction of cap, ramp to exploit)
#   SIGNAL 4 -- repeatRisk   (n in recentVals window = cycle warning)
#   SIGNAL 5 -- entropyPressure (variance of recentVals, chaos proxy)
# ----
# ----
#  PROBABILISTIC COLLATZ CORE
#  Returns a two-element list: {stepCount  exitReason}
#  exitReason: "converged" | "step_cap" | "blowup_cap"
#
#  AI probabilistic choice at every step:
#    probability 0.80  --> follow standard Collatz rule  (FIX 3)
#    probability 0.20  --> apply the opposite (swapped) rule
#
#  SAFETY CAPS (all three active):
#    CAP 1 -- maxStepLimit 500: hard iteration ceiling.      (FIX 2)
#    CAP 2 -- blowupLimit 1e9:  value ceiling.               (FIX 2)
#    CAP 3 -- termination via int() nearest-rounding check.
#
#  PURE INTEGER DISCIPLINE (FIX 1):
#    Every arithmetic result is immediately truncated with int().
#    An explicit "force integer" line follows each assignment.
#    This eliminates all floating-point residue that previously
#    caused the while-condition to miss the value 1.
#
#  STEP HISTORY (FIX 4):
#    stepHistory keeps the last 8 {stepNumber value} pairs.
#    The list is passed to logCapDiagnosis when any cap fires.
# ============================================================
# ============================================================
#  MAIN
#  Examples:
#    runTestSuite 0 → default random seed and default temperature 1.0 (recommended starting point)
#    runTestSuite 0 1.0 → default random seed and default temperature 1.0 (recommended starting point)
#       ( default temperature close to standard notation in AI models)
#    runTestSuite 0 0.8      --> cooler, more deterministic
#    runTestSuite 0 1.5      --> hotter, more random
#    runTestSuite 0 0.7 → lower temperature choices < 1.0 , stay much closer to standard Collatz iterations
#    runTestSuite 77777777  1.4 → different random seed integers !!!,  higher temperature choices > 1.0 ,
#    higher chance of swapped actions and loop detection, farther from standard Collatz
#    runTestSuite 7777487989 1.4 → more exploration, different random seed integers !!!
#    higher chance of swapped actions and loop detection
# ============================================================



Wiki Tables from Active State


Comparison of Deterministic Steps and Probabilistic Choices in Collatz iterations
# Probabilistic means random simulations -- output differs each run
# unless a fixed seed is supplied to seedTheRandom.
# Using multiple safety caps or clamps, Collatz Sequence is infinite,
# danger of endless loops in program.


Outputs from Active State


Random seed used: 1775910106
Running with temperature = 1.0
  CAP FIRED: seed=7  steps=230 finalVal=16 reason=loop_det/ent=0.0002
  Last 8 steps before cap:
    step 222   value = 16
    step 223   value = 8
    step 224   value = 25
    step 225   value = 76
    step 226   value = 38
    step 227   value = 19
    step 228   value = 10
    step 229   value = 5
  Quantum-Level: 7.852 for seed=7
  CAP FIRED: seed=15  steps=401 finalVal=22 reason=loop_det/ent=0.0001
  Last 8 steps before cap:
    step 393   value = 22
    step 394   value = 11
    step 395   value = 34
    step 396   value = 17
    step 397   value = 9
    step 398   value = 28
    step 399   value = 14
    step 400   value = 7
  Quantum-Level: 8.651 for seed=15
  CAP FIRED: seed=97  steps=402 finalVal=10 reason=loop_det/ent=0.0001
  Last 8 steps before cap:
    step 394   value = 10
    step 395   value = 31
    step 396   value = 94
    step 397   value = 47
    step 398   value = 24
    step 399   value = 12
    step 400   value = 6
    step 401   value = 3
  Quantum-Level: 8.655 for seed=97

-------------------------------------------------------------------------------------------------------------------
Seed   ProbStps DetStps  Exit           Diff Temp     AIExt  Kept Signals           Dropped Signals       
-------------------------------------------------------------------------------------------------------------------
2      1        1        converged        +0 1.00     conv   parity,trend,bit,budget,repeat,entropy (none)                
3      2        7        converged        -5 1.00     conv   parity,trend,bit,budget,repeat,entropy (none)                
5      393      5        converged      +388 1.00     conv   parity,trend,repeat,entropy bit,budget            
7      230      16       loop_det/ent   +214 1.00     loop   bit,budget,repeat,entropy parity,trend          
9      6        19       converged       -13 1.00     conv   parity,trend,bit,budget,repeat,entropy (none)                
15     401      17       loop_det/ent   +384 1.00     loop   parity,trend,bit,budget,entropy repeat                
25     336      23       converged      +313 1.00     conv   parity,trend,bit,budget,repeat,entropy (none)                
27     18       111      converged       -93 1.00     conv   parity,trend,bit,budget,repeat,entropy (none)                
97     402      118      loop_det/ent   +284 1.00     loop   parity,trend,bit,budget,repeat,entropy (none)                
100    20       25       converged        -5 1.00     conv   parity,trend,bit,budget,repeat,entropy (none)                

AI Algorithm Report

# Seed ProbSteps DetSteps Exit Diff Temp AIExt Kept Signals Dropped Signals TicketSteps BasSteps Reduction%
1 2 1 1 converged 0 1.0 conv parity,trend,bit,budget,repeat,entropy (6) none (0) 1 1 0%
2 3 2 7 converged -5 1.0 conv parity,trend,bit,budget,repeat,entropy (6) none (0) 271 271 0%
3 5 393 5 converged 388 1.0 conv parity,trend,repeat,entropy (4) bit,budget (2) 3 16 33%
4 7 230 16 loop_det/ent 214 1.0 loop bit,budget,repeat,entropy (4) parity,trend (2) 3 329 33%
5 9 6 19 converged -13 1.0 conv parity,trend,bit,budget,repeat,entropy (6) none (0) 4 4 0%
6 15 401 17 loop_det/ent 384 1.0 loop parity,trend,bit,budget,entropy (5) repeat (1) 4 447 16%
7 25 336 23 converged 313 1.0 conv parity,trend,bit,budget,repeat,entropy (6) none (0) 11 11 0%
8 27 18 111 converged -93 1.0 conv parity,trend,bit,budget,repeat,entropy (6) none (0) 500 500 0%
9 97 402 118 loop_det/ent 284 1.0 loop parity,trend,bit,budget,repeat,entropy (6) none (0) 500 500 0%
10 100 20 25 converged -5 1.0 conv parity,trend,bit,budget,repeat,entropy (6) none (0) 498 498 0%
Audit - - - - - - - All 6: parity,trend,bit,budget,repeat,entropy Dropped=zeroed in mask - - All runs used temperature control.

--- End AI Algorithm Report


Table. General Comparison

# Seed StateMachine Steps Prob Steps Behavior Note
1 2 1 1 Reaches 1 almost certainly. Very short path.
2 3 7 2 Negative drift from 0.80 divide bias aids convergence.
3 5 5 393 Short paths dominate in stochastic model.
4 7 16 230 Medium length typical. Moderate variation.
5 9 19 6 19 det. steps confirmed by hand trace.
6 15 17 401 Moderate stochastic variation around reference.
7 25 23 336 Longer but still terminates.
8 27 111 18 Famous long hailstone seed.
9 97 118 402 High variation possible.
10 100 25 20 Usually moderate length.
Audit - - - All state machine seeds reach 1. AI prob. model converges almost surely.

End Wiki Table


Lottery Ticket Pruning Results


# Seed BaseSteps(all 6) TicketSteps Kept (n) Kept Signal Names Dropped (n) Dropped Signal Names Reduction%
1 2 1 1 6 parity, trend, bit, budget, repeat, entropy 0 none 0%
2 3 271 271 6 parity, trend, bit, budget, repeat, entropy 0 none 0%
3 5 16 3 4 parity, trend, repeat, entropy 2 bit, budget 33%
4 7 329 3 4 bit, budget, repeat, entropy 2 parity, trend 33%
5 9 4 4 6 parity, trend, bit, budget, repeat, entropy 0 none 0%
6 15 447 4 5 parity, trend, bit, budget, entropy 1 repeat 16%
7 25 11 11 6 parity, trend, bit, budget, repeat, entropy 0 none 0%
8 27 500 500 6 parity, trend, bit, budget, repeat, entropy 0 none 0%
9 97 500 500 6 parity, trend, bit, budget, repeat, entropy 0 none 0%
10 100 498 498 6 parity, trend, bit, budget, repeat, entropy 0 none 0%
Audit - - - - - - Many seeds work well with only 3-4 signals active.

End Lottery Ticket Results

----
Total cases      : 10
Above state mach : 5 (AI prob. took more steps)
Below state mach : 4 (AI prob. took fewer steps)
Equal state mach : 1 (matched state machine)
Avg P-D diff     : +146.70 steps
Audit passed     : 10 / 10
----

Results also saved to: collatz_results.txt





Mockup Displays for Pseudocode Development



Testing, NDS MockUp



Nassi–Shneiderman diagram style pseudocode


for the Collatz Conjecture, using the standard rule: if \(n\) is even, divide by 2; if odd, compute 3n+1


3n+1, repeating until n=1


# NSD-style pseudocode
# text
START
  INPUT n
  WHILE n != 1
    IF n is even
      n = n / 2
    ELSE
      n = 3 * n + 1
    END IF
    OUTPUT n
  END WHILE
STOP
# Compact wiki-friendly version
# text
START
  Read seed n
  While n is not 1
    Test parity
    If even -> n := n / 2
    If odd  -> n := 3n + 1
    Record n
  End While
STOP
# If you want branch labels
# text
WHILE n != 1
  IF even branch
    Next state: n / 2
  ELSE odd branch
    Next state: 3n + 1
END



gold 2/9/2026. Added categories, so can find message in Wiki.



Hidden Comments Section


Program Change Log

gold 2/3/2025. Testing, encountered initial difficulty in saving work? Long code blocks with or unmatched wiki markup can sometimes confuse the Tcl Wiki formatting engine, especially if fences are not balanced or a line begins with markup it treats specially.


gold 2/14/2026. Added Automatic Dump of Examples, Using ActiveState.


gold 2/14/2026. convert to strict 7-bit ASCII for Playground V9. reporting error at bottom. program should run to completion with automatic test suite.


gold 2/14/2026.



gold 3/7/2026. convert to strict 7-bit ASCII for Playground V9. variables need to be human readable and very explanatory. avoid variables with single letter names. Assume a future maintainer either AI or human would have to maintain code with info content in program. the program is working the numbers correctly . so minimal changes.


gold 3/10/2026. Other than a clipping function or a number clamp { y =< limit } in tcl program, not sure how to separate lower solutions band from upper solutions band. Are you able to produce 2 sets of x,y columns for fitting upper and lower solutions, from the 500 points? Referee my weak eyes, but seems real possibility that quantized levels of solutions could be intermixing?


Matrix of Collatz solutions look like two swarms of bees rather a single linear solution or even look like multiple fuzzy levels of solution ranges, eg. non-linear solutions, observable in various pngs. You can tell me different. Based on long experience of fitting equations in engineering, possibly the probabilistic reasoning or pattern matching on quantum solutions plural is more adaptable.




Please place any comments here with your wiki MONIKER and date, Thanks.gold 3/4/2026



Note. Testing computer methods and computer programs, maybe wrong numbers.