Skip to content

SuperInstance/eisenstein-triples

eisenstein-triples

Eisenstein integer triples — generation, statistical analysis, and proof verification on hexagonal lattices.

An Eisenstein triple satisfies:

a² − ab + b² = c²

This is the norm equation in ℤ[ω] where ω = e^{2πi/3}, making it the hexagonal lattice analog of the Pythagorean triple a² + b² = c².

Why Eisenstein Triples?

The Pythagorean triples (a² + b² = c²) are deeply connected to the square lattice ℤ² and the Gaussian integers ℤ[i]. Eisenstein triples play the same role for the hexagonal lattice and the Eisenstein integers ℤ[ω]:

Property Pythagorean Eisenstein
Ring ℤ[i] ℤ[ω]
Norm a² + b² a² − ab + b²
Lattice Square Hexagonal
Symmetry group C₄ (4-fold) D₆ (12-fold)
Units {±1, ±i} (4) {±1, ±ω, ±ω²} (6)
Primitivity gcd(a,b) = 1 gcd(a,b,a−b) = 1

Eisenstein triples are ~25% denser than Pythagorean triples, making them more useful for constraint systems on hexagonal lattices.

Installation

pip install -e .

No external dependencies required — pure Python using only the standard library.

Quick Start

Generate Eisenstein Triples

from eisenstein_triples import generate_triples, primitive_triples

# All triples with c ≤ 100
triples = generate_triples(100)
for a, b, c in triples[:10]:
    print(f"({a}, {b}, {c})")

# Primitive triples only
prim = primitive_triples(50)
print(f"Primitive triples with c ≤ 50: {len(prim)}")

Output:

(-7, 8, 7)    norm=49
(-7, -1, 7)   norm=49
(-5, 8, 7)    norm=49
(-1, -7, 7)   norm=49
(1, 8, 7)     norm=49
(5, 3, 7)     norm=49
(-8, -5, 7)   norm=49
(-8, 7, 7)    norm=49
(-8, -7, 7)   norm=49
(-7, -8, 7)   norm=49

Parametric Generation

from eisenstein_triples import parametric_form

# Analogous to Euclid's formula for Pythagorean triples
# Eisenstein: (m²−n², 2mn−n², m²−mn+n²)
for m in range(2, 8):
    for n in range(1, m):
        a, b, c, valid = parametric_form(m, n)
        if valid:
            print(f"m={m}, n={n} → ({a}, {b}, {c})")

Weyl Orbit Enumeration

Every Eisenstein triple has a D₆ orbit of up to 12 related triples, generated by the 6 rotations and 2 conjugations of the hexagonal lattice:

from eisenstein_triples import weyl_orbit, norm

orbit = weyl_orbit(4, 1)
print(f"D₆ orbit of (4, 1): {len(orbit)} elements")
for a, b in orbit:
    print(f"  ({a}, {b})  norm = {norm(a, b)}")

Output:

D₆ orbit of (4, 1): 12 elements
  (-4, -1)  norm = 13
  (-4, 3)   norm = 13
  (-1, -4)  norm = 13
  (-1, 3)   norm = 13
  (1, -3)   norm = 13
  (1, 4)    norm = 13
  (3, -4)   norm = 13
  (3, 1)    norm = 13
  (4, -3)   norm = 13
  (4, 1)    norm = 13
  (-3, -1)  norm = 13
  (-3, 4)   norm = 13

All 12 elements have the same norm (13) — the norm is D₆-invariant.

Density Comparison

from eisenstein_triples import density_comparison

result = density_comparison(200)
print(f"Eisenstein triples: {result['eisenstein_count']}")
print(f"Pythagorean triples: {result['pythagorean_count']}")
print(f"Ratio (E/P): {result['ratio']:.4f}")
print(f"Eisenstein are {result['eisenstein_density_pct']:.1f}% denser")

Multiplication Closure

Eisenstein triples are closed under multiplication in ℤ[ω]:

from eisenstein_triples import multiplication_closure

result = multiplication_closure(100)
print(f"Closed: {result['closed']}, Failed: {result['failed']}")
# All should close: N(z₁z₂) = N(z₁)·N(z₂) always holds

Statistical Analysis (analyze.py)

The analyze module provides comprehensive statistical analysis of Eisenstein triples compared to Pythagorean triples:

python analyze.py

Analyses Performed

  1. Triple Density Comparison — count at various thresholds (100 to 65,536)
  2. Asymptotic Growth Analysis — log-log regression to determine growth exponent
  3. Weyl Orbit Analysis — group triples by orbit, compute orbit size distribution
  4. Prime Norm Distribution — classify norms by splitting behavior in ℤ[ω]
  5. Multiplication Closure Verification — statistical verification at scale

Key Results

from analyze import eisenstein_triples, pythagorean_triples

eis = eisenstein_triples(65536)
pyt = pythagorean_triples(65536)

print(f"Eisenstein:  {len(eis):>10,}")
print(f"Pythagorean: {len(pyt):>10,}")
print(f"Ratio:       {len(eis)/len(pyt):.4f}")

The growth exponent is approximately 2.0 for both families (consistent with quadratic parametrization), but the Eisenstein constant C is ~25% larger.

Prime Norm Analysis

In ℤ[ω], primes split according to their residue mod 3:

p mod 3 Behavior in ℤ[ω] Norm equation
0 Ramified (only p=3) 3 = −ω²(1−ω)²
1 Split: p = π·π̄ N(π) = p
2 Inert (stays prime) N(p) = p²

This means no prime ≡ 2 (mod 3) can appear as an Eisenstein norm — a deep connection between number theory and the hexagonal lattice.

from analyze import analyze_prime_distribution

analyze_prime_distribution(eis)
# Output confirms: all prime norms are ≡ 1 (mod 3) (except 3 itself)

Proof Verification (verify_proofs.py)

The verification suite checks all claimed mathematical results:

python verify_proofs.py

Checks Performed

  1. Hex Disk Formula3R² + 3R + 1 counts hex lattice points within radius R
  2. Eisenstein Norm Range — max norm in 12-bit range fits in 24 bits
  3. D₆ Orbit Count — 11 distinct orbits of neighbor colorings under D₆
  4. Triple Density Ratio — Eisenstein vs Pythagorean at multiple thresholds
  5. D₆ Norm Invariance — norm preserved under all 6 rotations + conjugation
  6. Parametric Form(m²−n², 2mn−n², m²−mn+n²) verified algebraically and numerically
  7. Multiplication ClosureN(z₁z₂) = N(z₁)·N(z₂) for random products
  8. Laman Redundancy — convergence to 1.5× (2D) and 2.0× (3D FCC)
  9. FCC Nearest Neighbors — exactly 12 nearest neighbors at distance √2

Example Output

## 6. Parametric Eisenstein Triple Form
  ✅ (m²-n², 2mn-n², m²-mn+n²) is always an Eisenstein triple (1000 trials)
    Algebraic proof:
    a² = m⁴ - 2m²n² + n⁴
    -ab = -2m³n + m²n² + 2mn³ - n⁴
    b²  = 4m²n² - 4mn³ + n⁴
    Sum = m⁴ - 2m³n + 3m²n² - 2mn³ + n⁴
    c²  = (m²-mn+n²)² = m⁴ - 2m³n + 3m²n² - 2mn³ + n⁴  ✓  QED

## 7. Eisenstein Multiplication Closure
  ✅ Norm multiplicativity: N(z₁z₂) = N(z₁)N(z₂) (1000 trials)

Mathematical Reference

Eisenstein Integers

ω = e^{2πi/3} = −1/2 + i√3/2
ω² = ω̄ = −1/2 − i√3/2
ω³ = 1
1 + ω + ω² = 0

Multiplication Rule

(a₁ + b₁ω)(a₂ + b₂ω) = (a₁a₂ − b₁b₂) + (a₁b₂ + b₁a₂ − b₁b₂)ω

Norm

N(a + bω) = a² − ab + b² = |a + bω|²

Parametric Form

For m > n > 0, gcd(m, n) = 1, 3 ∤ (m − n):

a = m² − n²
b = 2mn − n²
c = m² − mn + n²

This is analogous to Euclid's formula for Pythagorean triples: (m² − n², 2mn, m² + n²).

Related SuperInstance Projects

Development

pip install -e ".[dev]"
pytest

License

Extracted from lau-constellation. See parent repo for license information.

About

Eisenstein integer triples with D₆ symmetry and hexagonal lattice applications

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages