DEV Community

Cover image for From 2-Adic Geometry to Cunningham Chains: Visualization-Driven GPU Search
Nenad Mićić
Nenad Mićić

Posted on • Edited on

From 2-Adic Geometry to Cunningham Chains: Visualization-Driven GPU Search

**Update (March 17, 2026): Since publishing this post, the campaign found two first-kind CC18s with roots 106103983461039119546815109 (87 bits) and 214325014495971624590189129 (88 bits). A later prior-art review showed that first-kind CC18 had already been documented in John Armitage’s 2021 Oxford thesis via the smallest known example, so these are not the first known CC18s. They do, however, remain the largest listed first-kind CC18 entries on the current public Cunningham tables. The campaign has now finished because my available GPU compute time ran out. The original post below is left mostly unchanged as the March 11 baseline.


From 2-Adic Geometry to Cunningham Chains: Visualization-Driven GPU Search

Nenad Mićić · LinkedIn · March 2026
2-Adic Tree Explorer

What This Is

A visualization hobby project that turned into a high-throughput Cunningham chain search engine. More about HPC optimization and AI-assisted iteration than the math itself.

It started with mapping integers in a 2-adic geometry, noticing structured prime paths, recognizing Cunningham-chain recurrences, and then building a GPU/CPU pipeline to search for long chains.

2-adic square-perimeter map with CC1/CC2 edges and chain paths

Results

This project ultimately did reach its CC18 target, but not the more ambitious CC19 goal. It remained a compute-limited campaign.

As of March 2026, the public Cunningham chain tables at pzktupel.de list results under my name, Nenad Mićić, including:

  • new CC16 and CC17 entries
  • the largest listed first-kind CC16, CC17, and CC18 on the current public tables

The published data snapshot contains 929,574 roots in total, including 44 CC16 roots and 1 CC17. The main campaign was centered on the 89–91 bit range, and the release includes both the search code and derived analysis:

  • gap statistics and spacing distributions
  • immunization / residue summaries and immune-fingerprint distributions
  • p+1 breaker analysis
  • ghost chains — roots where prime links continue beyond the official chain break, tested to depth 20
  • closest CC-twins and CC-clusters (triplets, quadruplets, quintuplets)

I think this dataset is useful in its own right and deserves deeper study.

3D Fold - shell structure across levels

How It Works

Visual learning led to search design.

The 2-adic coordinate system made chain structure visible. The p+1 factorization view showed which small-factor patterns kill candidates early. That became the sieve.

For a first-kind chain, a root p generates: p, 2p+1, 4p+3, 8p+7, ...

The key optimization is depth filtering:

  • generate candidates on the CRT-and-wheel search lattice
  • test cheap modular conditions across the first d projected chain positions
  • reject any root whose chain is already doomed modulo a tracked small prime
  • send only the tiny survivor set to the CPU for probable-prime testing and full chain confirmation

Pipeline:

  • GPU (CUDA): 57–65 billion candidates/sec modular filtering (RTX 4090 / RTX 5090)
  • CPU (GMP): probable-prime testing, true-root recovery for non-roots, and chain-length confirmation

The GPU sieve rejects about 99.9988% of candidates before expensive primality work is needed. Only about 0.0012% survive to the CPU path.

topdown view - factor coloring for primes, mod-p view for composites

Interactive Visualizations

Each tool shaped the search design.

Heatmap + Decay curves

Project Stack

  • Search: CUDA filtering, GMP proving, prefix sharding, checkpointing
  • Visualization: standalone HTML/JS tools
  • Analysis: Python plus HTML tools for autopsy and fingerprinting
  • AI-assisted: LLMs used for coding iteration; math direction and search decisions are human-driven
  • Extra: a PARI/GP library and a small MCP server wrapper for interactive Cunningham-chain analysis

Part of the project was also an experiment in AI-assisted iteration: not one-shot prompting, but many rounds of visual exploration, code generation, rejection, correction, and performance tuning. The transferable lesson for me was not number theory itself, but the workflow: isolate the hot path, turn it into something benchmarkable, iterate quickly with AI assistance, and only bring back changes that survive measurement.

Immunization Result

Links

Chain Analyzer - single-chain analysis, breaker autopsy, residue immunity

3D fold 2adic

Top comments (0)