DEV Community

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

Posted on

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

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 has not yet reached its original target: finding first-kind CC18 or CC19. This was 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 current smallest known second-kind CC17
  • the current largest known first-kind CC17

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.

Depth filtering:

  • for each candidate root, cheaply test modular residues across the first d chain positions before any expensive primality test
  • GPU does the bulk rejection
  • CPU only proves the tiny survivor set

Pipeline:

  • GPU (CUDA): 57–65 billion candidates/sec modular filtering (RTX 4090 + RTX 5090)
  • CPU (GMP): primality proving on survivors only

The GPU sieve kills 99.9988% of candidates before any primality test is needed. Only 0.0012% survive to BPSW proving.
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

Top comments (0)