Coprime Lattice & Riemann Hypothesis Explorer

Interactive visualization of primitive lattice vectors, gcd(a,b)=1 patterns, and their deep connection to ζ(s) zeros
Explore More: FinitePrimesFareyCompositeEthiopian2πr1/2RationalInfinite ModuliPythagoreanTransformPhaseGeminiRebuildGoldbach
Introduction
Explorer

Welcome to the Coprime Lattice Explorer

This tool provides an interactive visualization of one of the most beautiful connections in mathematics: the relationship between coprime integer pairs (primitive lattice vectors) and the Riemann Hypothesis, one of the most important unsolved problems in mathematics.

Main Theorem: The probability that two random integers are coprime converges to 6/π² ≈ 0.6079, which equals 1/ζ(2).

This explorer focuses on primitive lattice vectors - points (a,b) where gcd(a,b) = 1, also known as "visible points" from the origin. These points form the building blocks of the integer lattice and have profound connections to Gaussian integers, Fermat's Two-Square Theorem, and the distribution of prime numbers.

What Are Coprime Numbers?

Two integers a and b are coprime (or relatively prime) if their greatest common divisor (GCD) is 1. In other words, they share no common factors except 1. These pairs form primitive lattice vectors that are "visible" from the origin when you imagine standing at (0,0) and looking through the lattice.

Examples:
  • gcd(8, 15) = 1 → Coprime ✓ (Primitive vector)
  • gcd(12, 18) = 6 → Not coprime ✗ (Blocked by (2,3))
  • gcd(7, 11) = 1 → Coprime ✓ (Primitive vector)

Gaussian Integers & Norm

Each lattice point (a,b) corresponds to a Gaussian integer z = a + bi. The norm is N(z) = a² + b², which measures the squared distance from the origin. Fermat's Two-Square Theorem states that a prime p can be written as a sum of two squares (p = a² + b²) if and only if p ≡ 1 (mod 4) or p = 2.

A fundamental result in number theory states that the probability that two randomly chosen integers are coprime is 6/π² ≈ 0.607927. This remarkable constant connects the geometry of circles (π) with the distribution of prime numbers!

P(gcd(a,b) = 1) = 6/π² = 1/ζ(2) = Σ 1/n² = 1 - 1/4 - 1/9 - 1/25 + ...

The Riemann Zeta Function

The Riemann zeta function ζ(s) is defined for complex numbers s with Re(s) > 1 as:

ζ(s) = Σ(n=1 to ∞) 1/n^s = 1/1^s + 1/2^s + 1/3^s + 1/4^s + ...

This function has a deep connection to prime numbers through the Euler product formula:

ζ(s) = ∏(p prime) 1/(1 - p^(-s))

The reciprocal of ζ(s) can be expressed using the Möbius function μ(n):

1/ζ(s) = Σ(n=1 to ∞) μ(n)/n^s

where μ(n) = 1 if n is a product of an even number of distinct primes, -1 if n is a product of an odd number of distinct primes, and 0 if n has a squared prime factor.

The Riemann Hypothesis

The Riemann Hypothesis (RH) is one of the seven Millennium Prize Problems, with a $1 million prize for its proof. It states:

Riemann Hypothesis: All non-trivial zeros of the Riemann zeta function ζ(s) lie on the critical line Re(s) = 1/2 in the complex plane.

In other words, if ζ(s) = 0 and s is not a negative even integer, then s = 1/2 + it for some real number t.

Connection to Coprime Lattice Points

Let V(R) be the number of coprime lattice points (a, b) inside a disc of radius R centered at the origin. The Gauss Circle Problem and related theory tell us:

V(R) = (6/π²) · πR² + E(R)

where E(R) is the error term. The exponent in the error bound is directly related to the zeros of ζ(s):

Key Connection: The Riemann Hypothesis is equivalent to the statement that |E(R)| = O(R^(1/2 + ε)) for any ε > 0.

The exponent 1/2 here is exactly Re(s) = 1/2 from the critical line!

This means that how coprime lattice points distribute in a circular region is fundamentally connected to where the zeros of ζ(s) lie in the complex plane.

Tool Features

Grid Parameters

Generate lattice grids from 1×1 up to 10,000×10,000 points with customizable resolution and point size.

Color Schemes

Multiple visualization modes including classic, heatmap, rainbow by GCD, and more to highlight different patterns.

Disc Analysis

Compute V(R), the error term E(R), and verify the relationship to RH by analyzing circular regions.

Möbius Statistics

Calculate Möbius function sums and verify convergence to 1/ζ(2) = 6/π².

Zoom & Pan

Zoom up to 20x and pan around to explore specific regions in detail.

Point Labels

Label points by GCD, fraction, coordinates, reduced fraction, polar form, or norm. Choose overlay, replace, or offset styles. Filter to coprime points only with customizable appearance.

Point Inspector

Click any point to see its properties: GCD, polar coordinates, modular properties, and more.

Export Options

Export visualizations as PNG (with statistics), SVG, CSV (23 properties per point), or JSON statistics. Comprehensive data includes polar coordinates, Gaussian integer properties, Farey fractions, and modular residues.

How to Use This Tool

1. Basic Exploration

  • Click the "Explorer" tab above to access the interactive tool
  • Start with a moderate grid size (500×500) and click "Generate Visualization"
  • Green/white points are coprime pairs; other colors indicate non-coprime pairs
  • Observe the density and distribution patterns

2. Analyzing the Riemann Hypothesis Connection

  • Enable "Show Radius Circle" in the Visualization section
  • Adjust the circle radius R to different values
  • Check the "Disc Analysis" statistics to see V(R), E(R), and |E(R)|/R^(1/2)
  • The ratio |E(R)|/R^(1/2) should remain bounded if RH is true

3. Detailed Point Inspection

  • Click on any point in the visualization
  • The "Point Inspector" panel shows: coordinates, GCD, polar form, modular properties
  • Compare coprime vs non-coprime points to understand the patterns

4. Zooming and Labeling

  • Use the Zoom slider to magnify regions (up to 20x)
  • Pan using the X and Y offset sliders (or drag the canvas)
  • Enable "Show Point Labels" and choose a label type (GCD, fractions, polar, norm)
  • Choose label style: Overlay (on points), Replace (instead of points), or Offset (above points)
  • Adjust font size and threshold for optimal visibility
  • Enable "Label Coprime Only" to focus on primitive vectors

5. Statistical Analysis

  • Check "Global Statistics" for overall coprime density (should approach 6/π² ≈ 0.6079)
  • Review "Möbius Function Analysis" to see Σμ(n)/n² converging to 6/π²
  • Export statistics as JSON for further analysis
  • Comprehensive exports: CSV includes 23 properties per point (polar, Gaussian, Farey, modular)

Mathematical Background

Why 6/π²?

The probability that gcd(a,b) = 1 equals 6/π² because:

P(gcd(a,b) = 1) = ∏(p prime) P(p does not divide both a and b) = ∏(p prime) (1 - 1/p²) = 1/ζ(2) = 1/(π²/6) = 6/π²

Key Mathematical Results

Coprime Density: lim P(gcd(a,b)=1) = 6/π² = 1/ζ(2)
Average Totient: lim (1/N)Σφ(m)/m = 6/π²
Farey Growth: |F_n| ~ (3/π²)n²
Primitive Vectors: Count in disc of radius R ~ (6/π)R²
Euler Product: ζ(s) = ∏(1 - p^(-s))^(-1) over all primes p
Möbius Function: 𝟙_gcd=1 = Σ μ(d) over divisors d
RH Connection: Error term E(R) = O(R^(1/2+ε)) ⟺ Riemann Hypothesis

The Error Term and RH

If we count coprime points in a disc, the main term is (6/π²)πR² = 6R²/π. The error E(R) measures the deviation from this expectation. Better bounds on E(R) are equivalent to information about ζ(s) zeros:

  • E(R) = O(R) is easy to prove (trivial bound)
  • E(R) = O(R^(2/3)) can be proven unconditionally
  • E(R) = O(R^(1/2 + ε)) is equivalent to RH
  • E(R) = O(R^(1/2)) would be the best possible bound

Möbius Function and Prime Numbers

The Möbius function μ(n) encodes information about the prime factorization of n:

  • μ(n) = 1 if n is a product of an even number of distinct primes
  • μ(n) = -1 if n is a product of an odd number of distinct primes
  • μ(n) = 0 if n has a squared prime factor

Its summatory properties are intimately connected to the distribution of primes and the zeros of ζ(s). The sum M(N) = Σμ(n) oscillates around zero, and RH implies |M(N)| = O(N^(1/2 + ε)).

Euler's Totient Function φ(m)

The totient function φ(m) counts how many integers from 1 to m are coprime to m. The ratio φ(m)/m represents the "coprime density" for a specific modulus m. Averaging these ratios over all moduli converges to 6/π².

lim (n→∞) (1/n) Σ(m=1 to n) φ(m)/m = 6/π²

Note: While primes have φ(p)/p = (p-1)/p → 1, which is higher than 6/π² ≈ 0.608, primes become increasingly sparse, so composite numbers with lower ratios dominate the average.

Ready to Explore?

Click the "Explorer" tab above to begin your journey into the beautiful world of coprime lattice points and their connection to one of mathematics' deepest mysteries!

Technical Features:
  • Grid sizes from 1×1 to 10,000×10,000
  • High-resolution canvas rendering (2K/4K/8K export)
  • Real-time statistics with disc analysis
  • Zoom up to 20x with pan controls
  • Point inspector with polar/modular properties
  • Multiple color schemes and labeling options
  • Export to PNG (with legend), SVG, CSV, and JSON
  • Professional academic styling
  • Mobile-compatible interface

Author: Wessen Getachew (@7dview)

Theme: Classical analytic number theory with modern interactive visualization

Built with HTML5 Canvas • Pure JavaScript • No external dependencies

Point Inspector

Click on a point to inspect its properties

Grid Parameters

500
3

Visualization

40%

Mathematical Overlays

Advanced Analysis

Labels

100
12px

Zoom & Pan

1.0x
0%
0%

Analysis

Computing...

Export

📊 Comprehensive Exports:
• PNG: Full grid view (resets zoom/pan)
• CSV: 23 properties per point including polar, Gaussian integer, Farey fractions, modular properties
• JSON: Nested structure with all mathematical data

Presets

Riemann Hypothesis Connection:
V(R) = (6/π²)πR² + O(R^(1/2+ε))

The exponent 1/2 in the error term is exactly Re(s) = 1/2 on the critical line.
?

⌨️ Keyboard Shortcuts

?Toggle this help
SpaceRegenerate visualization
GToggle grid lines
AToggle axes
CToggle radius circle
DToggle diagonals
FToggle Farey sequence
PToggle prime filter
RToggle radial density plot
LToggle point labels
↑ ↓ ← →Pan view (5% increments)
Shift + ↑↓←→Pan view (1% increments)
+ / =Zoom in
- / _Zoom out
0Reset zoom and pan
1-6Apply preset 1-6
EExport PNG
SExport SVG
JExport JSON statistics
Ctrl/Cmd + CCopy statistics to clipboard

Global Statistics

Total Points: -
Coprime Points: -
Non-Coprime Points: -
Coprime Density: -
Theoretical (6/π²): 0.607927
Relative Error: -

Disc Analysis (Radius R)

Radius R: -
Points in Disc: -
Coprime in Disc V(R): -
Expected (6/π²)πR²: -
Error E(R): -
|E(R)|/R^(1/2): -
log₁₀|E(R)|: -

Möbius Function Analysis

M(N) = Σμ(n): -
|M(N)|/N^(1/2): -
Σμ(n)/n: -
Σμ(n)/n²: -
Expected (1/ζ(2)): 0.607927
GCD Values Found: -
μ-Function Range: -1 to +1

Computational Details

Grid Dimensions: -
Canvas Size: -
Point Size: -
Total Pixels: -
Generation Time: -
Memory (approx): -
Color Scheme: -
Zoom Level: 1.0x
Performance: -
💡 Quick Tips
🖱️ Mouse:
  • Drag canvas to pan
  • Scroll wheel to zoom
  • Hover for quick info
  • Click for details
⌨️ Keyboard:
  • Press ? for shortcuts
  • Space to regenerate
  • Arrow keys to pan
  • +/- to zoom
🎯 Analysis:
  • Enable circle for RH error
  • Use presets (1-6 keys)
  • Prime filter reveals patterns
  • Plots show convergence
About This Tool

Coprime Lattice & Riemann Hypothesis Explorer visualizes primitive lattice vectors and their deep connections to the Riemann zeta function, Gaussian integers, and the distribution of primes.

Built using HTML5 Canvas with pure JavaScript. Implements efficient GCD computation via Euclidean algorithm, Möbius function evaluation, and real-time statistical analysis of coprime density convergence to 6/π² ≈ 0.607927.

Key Features: Zoom & pan, point inspection with polar/modular properties, disc analysis for RH error bounds, multiple export formats (PNG with legend, SVG, CSV, JSON), customizable labeling and color schemes.

Author: Wessen Getachew (@7dview) | Theme: Classical analytic number theory with modern interactive visualization