Open computational mathematics. AI-audited, not peer-reviewed. All code and data open for independent verification.

by cahlen in-progress

Hardware

8× NVIDIA B200 (183 GB VRAM each, 1.43 TB total) 2× Intel Xeon Platinum 8570 (112 cores / 224 threads) 2 TB DDR5 RAM
algebraic-number-theoryclass-groupscohen-lenstra-heuristics b200dgxnvlink cuda-kernelbsgscontinued-fractionsl-functions

Key Results

Problem
Class number distribution for real quadratic fields
Conjecture Year
1,984
Current Frontier
d up to ~10¹¹ (Jacobson et al.)
Target
d up to 10¹³ (100× extension)
Status
Two ranges complete: [10⁹, 10¹⁰] (2.74B disc) and [10¹⁰, 10¹¹] (27.4B disc). 30B total.
Discriminants Range1
2.7×10⁹
Discriminants Range2
2.7×10¹⁰
H1 Fraction Range1
0.167
H1 Fraction Range2
0.1,535
Time Range1
30 minutes on 8× B200
Time Range2
16.5 hours on 8× B200

Class Numbers of Real Quadratic Fields: Extending Tables to 101310^{13}

Abstract

We compute class numbers h(d)h(d) of real quadratic fields Q(d)\mathbb{Q}(\sqrt{d}) for all fundamental discriminants dd from 101110^{11} to 101310^{13} — a 100× extension of existing systematic tables. Each discriminant is handled by an independent CUDA thread using the analytic class number formula combined with continued-fraction computation of the regulator. The resulting dataset tests the Cohen-Lenstra heuristics at this scale, specifically the prediction that h(d)=1h(d) = 1 occurs with probability 75.446%\approx 75.446\% for real quadratic fields.

Background

Class Numbers

The class number h(K)h(K) of a number field KK measures the failure of unique factorization in its ring of integers. For the real quadratic field Q(d)\mathbb{Q}(\sqrt{d}):

  • h(d)=1h(d) = 1 means the ring Z[1+d2]\mathbb{Z}[\frac{1+\sqrt{d}}{2}] (or Z[d]\mathbb{Z}[\sqrt{d}]) has unique factorization
  • h(d)>1h(d) > 1 means unique factorization fails, and the class group has non-trivial structure

The Analytic Class Number Formula

For a fundamental discriminant d>0d > 0:

h(d)R(d)=d2L(1,χd)h(d) \cdot R(d) = \frac{\sqrt{d}}{2} \cdot L(1, \chi_d)

where:

  • R(d)=logεdR(d) = \log \varepsilon_d is the regulator (logarithm of the fundamental unit)
  • L(1,χd)=n=1χd(n)nL(1, \chi_d) = \sum_{n=1}^{\infty} \frac{\chi_d(n)}{n} is the Dirichlet LL-function
  • χd(n)=(dn)\chi_d(n) = \left(\frac{d}{n}\right) is the Kronecker symbol

The regulator is computed from the continued fraction expansion of d\sqrt{d}: the period of the CF gives the fundamental unit εd\varepsilon_d, and R(d)=logεdR(d) = \log \varepsilon_d.

The Cohen-Lenstra Heuristics

Cohen and Lenstra (1984) proposed a remarkable probabilistic model for class groups. For real quadratic fields, they predict:

Prob(h(d)=1)=p prime(11p)(11p2)0.75446\text{Prob}(h(d) = 1) = \prod_{p \text{ prime}} \left(1 - \frac{1}{p}\right)\left(1 - \frac{1}{p^2}\right) \approx 0.75446

More generally, they predict the distribution of the odd part of the class group: an abelian group GG occurs with probability proportional to 1/Aut(G)1/|\text{Aut}(G)|.

These heuristics have been tested computationally up to d1011d \sim 10^{11} and agree beautifully, but more data at larger discriminants is needed to:

  1. Test whether the convergence continues
  2. Look for deviations that might reveal deeper structure
  3. Understand the distribution of large class numbers

Current Frontier

AuthorsYearRangeKey Result
Jacobson, Ramachandran, Williams2006-2015d1011d \leq 10^{11}Systematic class numbers via BSGS
Watkins2004Imaginary quadratic, d1010d \leq 10^{10}Complete tables
Belabas, CohenVariousCubic fields, d107d \leq 10^7Limited by algorithm complexity

No systematic GPU-accelerated computation exists. The BSGS algorithm is embarrassingly parallel — each discriminant is independent — making it ideal for GPU acceleration.

Hardware

ComponentSpecification
NodeNVIDIA DGX B200
GPUs8× NVIDIA B200 (183 GB VRAM each)
Total VRAM1.43 TB
GPU InterconnectNVLink 5 (NV18), full mesh
CPUs2× Intel Xeon Platinum 8570
System RAM2 TB DDR5

Method

Pipeline (all on GPU)

Phase 1: GPU Squarefree Sieve. Each thread checks its position for divisibility by p2p^2 for all primes pdp \leq \sqrt{d}. Classifies fundamental discriminants (d1(mod4)d \equiv 1 \pmod{4} squarefree, or d=4md = 4m with m2,3(mod4)m \equiv 2,3 \pmod{4} squarefree). Stream-compacts into packed array.

Phase 2: Regulator. Each thread computes R(d)=logεdR(d) = \log \varepsilon_d via continued fractions in log-space (avoids integer overflow):

  • d0(mod4)d \equiv 0 \pmod{4}: CF of d/4\sqrt{d/4}, first D=1D=1 before convergent update
  • d1(mod4)d \equiv 1 \pmod{4}: CF of (1+d)/2(1+\sqrt{d})/2 with reduced-state cycle detection, R=log(εend)log(εstart)R = \log(\varepsilon_{\text{end}}) - \log(\varepsilon_{\text{start}})

Validated: exact match with PARI/GP quadregulator() on 1000 discriminants.

Phase 3: L-function. Euler product with 9,592 primes up to 99,991 in __constant__ memory. Each thread computes L(1,χd)=p(1χd(p)/p)1L(1, \chi_d) = \prod_p (1 - \chi_d(p)/p)^{-1} via modular exponentiation (Kronecker symbol). Log-sum accumulation for numerical stability.

Phase 4: Assembly. h(d)=round(dL(1,χd)2R(d))h(d) = \text{round}\left(\frac{\sqrt{d} \cdot L(1,\chi_d)}{2 R(d)}\right). Atomic histogram updates for Cohen-Lenstra statistics.

Parallelization

8 GPUs via pthreads, each processing its own range. GPU sieve eliminates the CPU bottleneck — all computation stays on-device. Chunks of 3×1073 \times 10^7 integers processed in sequence per GPU.

Results

Completed: d[109,1010)d \in [10^9, 10^{10}) — 2.74 billion discriminants

StatisticValue
Fundamental discriminants2,735,671,820
Time30 minutes (8× B200)
Throughput1.5M discriminants/sec

Class Number Distribution

hhCountFraction
1456,984,42016.70%
2606,415,56222.17%
373,409,1252.68%
4540,733,20219.77%
522,715,1430.83%
696,852,0273.54%
710,849,0130.40%
8298,291,86110.90%
16123,589,4414.52%

Cohen-Lenstra p-divisibility

StatisticObservedC-L predicted
h=1h = 116.70%75.446% (asymptotic)
3h3 \mid h15.28%
5h5 \mid h4.89%
7h7 \mid h2.35%

Key Finding: Convergence to Cohen-Lenstra Is Very Slow

Rangeh=1h = 1 fractionValidated by
d<104d < 10^442.1%PARI/GP (exact match)
d106d \sim 10^625.7%PARI/GP
d[109,2×109)d \in [10^9, 2 \times 10^9)17.5%This work
d[109,1010)d \in [10^9, 10^{10})16.7%This work
Asymptotic prediction75.446%Cohen-Lenstra (1984)

The h=1h = 1 fraction is DECREASING in this range, not converging toward 75.4%. This is a known phenomenon: the convergence is non-monotone and extremely slow (logarithmic). The distribution is dominated by powers of 2 (h=2,4,8,16h = 2, 4, 8, 16) at moderate discriminants, reflecting the genus theory structure of real quadratic class groups.

Status: d[1010,1013)d \in [10^{10}, 10^{13}) — planned

At 1.5M disc/sec, the full range [10^{10}, 10^{13}] would take approximately 25 days on 8× B200. This is feasible as an extended computation.

Reproducibility

git clone https://github.com/cahlen/idontknow
cd idontknow
nvcc -O3 -arch=sm_100a -o class_v2 \
    scripts/experiments/class-numbers/class_numbers_v2.cu -lpthread -lm

# Validate: d = 5 to 10000 (should give h=1 at 42.13%, matching PARI/GP)
./class_v2 5 10000

# Medium run: d = 10^9 to 2×10^9 (~95 sec on 8× B200)
./class_v2 1000000000 2000000000

# Full run: d = 10^9 to 10^10 (~30 min on 8× B200)
./class_v2 1000000000 10000000000 | tee data/class-numbers/run.log

References

  • Cohen, H. and Lenstra, H.W. Jr. (1984). “Heuristics on class groups of number fields.” Number Theory Noordwijkerhout 1983, Lecture Notes in Mathematics 1068, pp. 33—62.
  • Jacobson, M.J. Jr., Ramachandran, S., and Williams, H.C. (2006). “Numerical results on class groups of imaginary quadratic fields.” Mathematics of Computation, 75(254), pp. 1003—1024.
  • Watkins, M. (2004). “Class numbers of imaginary quadratic fields.” Mathematics of Computation, 73(246), pp. 907—938.
  • Shanks, D. (1971). “Class number, a theory of factorization, and genera.” Proceedings of Symposia in Pure Mathematics, 20, pp. 415—440.

Computed on NVIDIA DGX B200. Code: scripts/experiments/class-numbers/class_numbers_v2.cu.

This work was produced through human–AI collaboration (Cahlen Humphreys + Claude). Not independently peer-reviewed. All code and data open for verification at github.com/cahlen/idontknow.

Recent Updates

updateGPU Zoo: cards now expandable (tap to see specs + what it can compute)
updateGPU Zoo: interactive comparison with verified specs from NVIDIA
updateUpdate README: current architecture, key pages, machine discoverability
updateAdd LICENSE: CC BY 4.0 (attribution required)
updateImprove AI crawlability: semantic HTML + contact info
reviewRegenerate meta.json + certifications.json (now auto-generated)
updateAdd /meta.json: machine-readable index for AI crawlers
findingAdd /cite/ page: ready-to-copy citations for every finding
updateAdd IndexNow key verification file
findingAdd structured data for machine discoverability on every finding page