Computational exploration of coprime pair distributions using classical summatory totient estimates
Mertens' totient formula applied to interval S_n = (1/(n+1), 1/n]
This visualization explores coprime fractions r/m within Farey sequence intervals (sectors). Each sector Sₙ = (1/(n+1), 1/n] contains fractions arranged in a circular ring, with colors indicating various mathematical properties.
| n | Interval | Exact | Pred | Err% | P(m) | C(m) | P/C |
|---|
📸 Screenshot Legend Information
The screenshot includes a comprehensive legend showing all visualization elements, statistics, and the Bisection Identity (Theorem 1) verification box. WARNING Note: The bisection identity will show FAIL (fail) when the boundary slider is enabled (< 1), as it requires all sectors included (boundary = 1) to hold. Set boundary to 1 for PASS verification.
Legend Font Size Control
Computational analysis of deviations between exact enumeration and Mertens' asymptotic formula C(n,N) = 3N²/(π²n(n+1)) applied to intervals. Error patterns may provide computational insight into classical results like the Franel-Landau connection to RH.
The Franel-Landau theorem (1924) established that RH ⟺ Σ|F_N - k/|F_N|| = O(N^(1/2+ε)). Interval decomposition may offer computational perspective on which ranges contribute to this classical sum.
FFT of error sequence may show peaks at frequencies related to imaginary parts of zeta zeros (14.13, 21.02, 25.01...). This would indicate explicit formula structure.
Correlation between errors and μ(n) tests for arithmetic structure. Non-zero correlation suggests prime factorization affects error distribution.
Calculate Σφ(k) for k=1 to N with detailed step-by-step breakdown and comprehensive data export
This framework uses two related but distinct formulas:
Relationship: Summing C(n,N) over all sectors n ≈ Σφ(k) (total coprime count)
Wessen Getachew
This work applies classical summatory totient estimates (Mertens, 1874) to Farey sequence intervals. We examine the distribution of coprime integer pairs (a,b) whose rational slope a/b lies in specific intervals S_n = (1/(n+1), 1/n]. The asymptotic count C(n,N) ~ (3/π²)N²/(n(n+1)) follows directly from applying Mertens' totient summation formula to the geometric constraint. This provides a computational framework for exploring interval-specific coprime density, complementing the well-known global density 6/π². We identify computational regimes where asymptotic estimates transition to discrete counting behavior.
The probability that two randomly chosen integers are coprime is 1/zeta(2) = 6/pi^2 approximately 0.6079, a classical result with interpretations in analytic number theory and geometry of numbers. Geometrically, this corresponds to the density of visible lattice points in Z^2.
Farey sequences organize rational numbers in [0,1] by increasing denominator and naturally partition rational directions into intervals. While global coprime density is well understood, we focus on directional coprime density - how primitive lattice points distribute across specific rational slope bands.
Intervals partitioning (0,1], bounded by consecutive Farey fractions.
Pairs with coprime coordinates representing visible lattice points.
Applying Mertens' summatory totient formula to Farey interval S_n = (1/(n+1), 1/n], we obtain:
Where C(n,N) counts coprime pairs (a,b) with 1 ≤ b ≤ N, gcd(a,b)=1, and a/b in S_n. This follows from classical totient summation.
Step 1: The geometric constraint a/b ∈ S_n = (1/(n+1), 1/n] translates to b/(n+1) < a ≤ b/n.
Step 2: For each denominator b, there are approximately b/(n(n+1)) integers a in this range.
Step 3: Restricting to coprime pairs: Σ_{b≤N} φ(b)/(n(n+1)) + O(N)
Step 4: Apply Mertens' classical summatory totient formula (1874):
Conclusion: C(n,N) = (1/(n(n+1))) * ((3/pi^2)N^2 + O(N log N))
| Sector n | Width 1/(n(n+1)) | Asymptotic Factor | Global Fraction |
|---|---|---|---|
| 1 | 1/2 | 3/(2pi^2) | approximately 0.1519 |
| 2 | 1/6 | 3/(6pi^2) | approximately 0.0506 |
| 3 | 1/12 | 3/(12pi^2) | approximately 0.0253 |
| n | 1/(n(n+1)) | 3/(pi^2 n(n+1)) | 1/n(n+1) * 6/pi^2 |
Numerical experiments confirm convergence to predicted asymptotics at rates consistent with O(N log N) error decay. Interactive visualizations above display accumulation of primitive lattice points within each Farey sector.
Global density 1/zeta(2) = 6/pi^2 emerges as sum of sectoral contributions.
Farey gap distribution relates to RH via: Sum|F_k - k/|F_N|| = O(N^(1/2+epsilon)) iff RH
Computational analysis shows that for any fixed N, there exists a transition point n* ≈ (√3/π)N ≈ 0.5513N where the asymptotic formula transitions from useful density estimation to sparse discrete counting. This computational boundary represents where expected counts drop below 1, entering a regime where relative error becomes unstable.
Just as the Nyquist frequency in signal processing defines the limit where wave reconstruction fails, this bound marks where the "Farey density wave" can no longer be treated as continuous.
Condition: The predicted count C(n,N) falls below unity when:
Solving for n: n² + n > (3/π²)N² implies n > (√3/π)N for large n
The Constant: √3/π ≈ 0.5513 emerges naturally from the interaction of:
| Property | Dense Regime (n < 0.55N) | Boundary (n ≈ 0.55N) | Sparse Regime (n > 0.55N) |
|---|---|---|---|
| Predicted Count | C(n,N) >> 1 | C(n,N) ≈ 1 | C(n,N) < 1 |
| Relative Error | Low, stable (< 5%) | Increasing noise | Oscillatory, unbounded |
| Identity Distribution | Spread across PP, PC, CP, CC | Concentrating | Single category dominates |
| Mathematical Regime | Analytic (Density) | Transitional | Discrete (Counting) |
Beyond the boundary, sectors enter a "quantum" regime where:
The formula predicts fractional counts (0.4, 0.7) but actual counts must be integers (0 or 1), causing wild relative error oscillations.
When a sector contains exactly one fraction, that fraction occupies precisely one P/C category, trivially satisfying the identity: 0+0+0+1 = 1.
The boundary constant provides a "resolution limit" for prime distribution analysis:
The Prime/Composite identities (PP + PC + CP + CC = Total) hold exactly in all regimes, including at and beyond the boundary. This persistence demonstrates that while density estimates fail, the underlying arithmetic structure remains inviolate. The boundary thus separates where we can predict counts from where we can only verify identities.
The map φ: r/m ↦ (m−r)/m is an involution on the Farey fractions with the following properties:
The sum r/m + (m−r)/m = 1 is an exact algebraic identity, not an approximate numerical result:
However, when computed in floating-point arithmetic, the sum may be displayed as 0.9999999... or 1.0000001... due to rounding errors in the binary representation. The tool displays 10 decimal digits and marks the sum with PASS (green check) if within 10⁻¹⁰ of 1.0, or FAIL (red X) if the error exceeds this tolerance (indicating a computational issue, not a mathematical violation).
The first Farey sector S₁ = (1/2, 1] has exactly one more coprime fraction than the union of all remaining sectors S₂ ∪ S₃ ∪ S₄ ∪ ⋯:
The +1 arises from the involution pairing between sectors:
WARNING Important: Boundary Condition
This identity only holds when the boundary slider is set to 1 (all sectors S₁, S₂, S₃, ... included). When you enable the boundary control and set it to a value less than 1, the identity will show FAIL (fail) because some high-index sectors are excluded from the count. The screenshot will display PASS only when boundary = 1 (full dataset).
Note: This identity is exact for coprime (gcd=1) fractions in the Farey sequence. If non-coprime fractions r/m with gcd(r,m)>1 are included, the count changes because reducible fractions like 2/4, 3/6, etc. collapse to simpler forms, altering the balance. The tool verifies the identity with PASS when it holds for the current dataset.
This work provides a computational framework for exploring coprime pair distributions across Farey sequence intervals. By applying Mertens' classical summatory totient formula to specific rational slope ranges, we obtain explicit asymptotic counts for each interval. Computational analysis reveals a transition point near n ≈ 0.55N where asymptotic density estimates give way to discrete arithmetic behavior. The framework enables systematic study of prime/composite categorization, modular constraints, and the interplay between continuous approximation and discrete counting in number-theoretic distributions.
See References tab for foundational works and acknowledgments.
Visual exploration of classical totient estimates applied to Farey sequence intervals
For consecutive Farey fractions a/b and c/d, the gap between them equals exactly 1/(b*d). This elegant formula shows that gaps decrease as denominators grow. The distribution reveals how fractions cluster and spread across the unit interval.
| # | Left Fraction | Right Fraction | Actual Gap | Theoretical 1/(bd) | Match |
|---|
Define δ_k = F_k - k/|F_N| as the k-th Farey fraction deviation. The growth rate of Σ|δ_k| is directly equivalent to the Riemann Hypothesis. If RH is true, the sum grows slower than N^(1/2+ε) for any ε > 0. This provides a concrete computational test for RH properties through Farey sequence analysis. Note: These computations illustrate known equivalences but do not constitute a proof or disproof of RH.
Dedekind sums are arithmetic functions encoding properties of coprime pairs (h,k). They satisfy reciprocity formulas: s(h,k) + s(k,h) = -1/4 + (1/12)(h/k + k/h + 1/(hk)). These sums connect to modular forms and are fundamental in algebraic number theory.
| h | k | s(h,k) | 12k*s(h,k) | gcd |
|---|
| h | k | s(h,k) | s(k,h) | Sum | RHS | Match |
|---|
| r/m | CF [a0; a1, a2, ...] | Path | Length | Sum(a_i) | Max(a_i) | Freq | Play |
|---|
For each fraction, showing its left/right Farey neighbors and their mediant (the next fraction to appear between them as N increases).
Visualizes the density distribution C(n,N) ~ (3/π²)N²/(n(n+1)) as a 3D cone surface. The vertical axis represents sector number n, the radial axis shows N, and the height indicates fraction count. The cone shape reveals how coprime density concentrates in lower sectors and decreases as 1/n².
| r/m | θ (rad) | R | z = Re^iθ | Γ = (z-1)/(z+1) | |Γ| |
|---|
Overview: This tab explores how prime numbers manifest within the Farey sequence structure. Primes play a special role: for prime p, we have φ(p) = p-1 coprime residues, giving primes maximal density. The distribution of prime denominators across sectors reveals deep connections to the Prime Number Theorem and twin prime conjectures.
Scatter plot showing Farey gaps where both neighboring denominators are twin primes (p, p+2). The x-axis shows the position in [0,1], y-axis shows gap size. Clusters indicate regions rich in twin prime structure.
Compares count of fractions with prime denominators (orange) vs composite denominators (purple) in each sector. Prime moduli contribute more fractions per unit since φ(p)/p = 1-1/p is larger for primes.
Counts prime constellations appearing in Farey denominators: Twin (p, p+2), Cousin (p, p+4), Sexy (p, p+6), and prime triplets. These patterns connect to the Hardy-Littlewood conjectures on prime gaps.
Shows φ(p) = p-1 for each prime denominator p. This linear growth demonstrates why primes contribute heavily to Farey sequences. The PNT reference line shows expected prime density π(x) ~ x/ln(x).
Lists Farey neighbors where both denominators form a twin prime pair. Click any pair to hear the interval between them as frequencies. Twin primes create distinctive harmonic relationships due to their close denominators.
Map Farey fractions to musical frequencies, explore consonance/dissonance, and visualize Arnold tongues
| Fraction | Ratio | Frequency | Cents | Closest Note | Interval Name | Mode | Play |
|---|
Exploring how primorial residue classes connect to Farey sector distribution
| Sector | Total | Per Class Avg | χ² Stat | Uniform? |
|---|
Overview: This module implements sublinear algorithms for prime counting and totient summation. The Meissel-Lehmer algorithm computes pi(x) in O(x^(2/3)) time instead of O(x), enabling analysis of much larger ranges. All primality tests use a precomputed sieve for O(1) lookup.
Count of primes less than or equal to x using Lucy_Hedgehog/Meissel-Lehmer
Sum of phi(k) for k=1 to n. Asymptotically 3n^2/pi^2
Analyze a single number: primality, totient, factorization
Given two Farey neighbors a/b and c/d, their mediant is:
The mediant always lies strictly between its parents and is in lowest terms when the parents are Farey neighbors (|ad - bc| = 1).
Sector Sn = (1/(n+1), 1/n] is bounded by:
The Gatekeeper 2/(2n+1) is the mediant of these boundaries.
Key insight: Mediants generated within a sector stay confined to that sector.
If a/b ∈ Sn and we take mediants with the sector boundaries, all descendants remain in Sn.
The Stern-Brocot subtree rooted at the Gatekeeper generates exactly the fractions in Sn ∩ FN.
| N | |F_N| | Σ|δ| | Σ|δ|/√N | Max Gap | Mean Gap |
|---|
Exploring Maxwell-like equations for arithmetic density fields
Maxwell's equations describe how electric and magnetic fields propagate through space. Similarly, we can define arithmetic density fields that describe how coprime pairs distribute across the rational number plane, with "sources" at prime denominators and "flows" along Farey sequences.
The "density field" at each point (r,m) in the integer lattice, weighted by Euler's totient function and enforcing coprimality via Kronecker delta.
Angular gradient of coprime count, showing how density "flows" between Farey sectors as we traverse the unit circle.
The divergence of the density field equals the "prime charge density" given by the Möbius function weighted by log(m). Prime denominators act as sources (ρ > 0), composite denominators with repeated factors act as sinks (ρ < 0), and square-free composites are neutral (μ = -1 provides cancellation).
The curl of the flow field equals the negative rate of change of density with respect to m. This captures the Stern-Brocot tree structure: as we increase denominators (∂/∂m), the angular distribution rotates, creating circulation patterns in the density field.
The flow field is divergence-free, reflecting totient conservation: Σφ(d) = n for divisors d|n. Fractions can't appear or disappear—they're redistributed through the Stern-Brocot tree structure.
The curl of density equals the change in flow plus a "mediant current" J_mediant representing the continuous generation of new fractions via the mediant operation (r₁+r₂)/(m₁+m₂). This is the Farey construction principle cast as an electromagnetic induction law.
Combining the curl equations yields a wave equation for density propagation:
This describes how coprime density "propagates" as denominators increase, with prime sources generating outward-spreading "waves" of fractions. The Laplacian ∇²D represents diffusion across angular directions (Farey neighbors).
The cross product of density and flow fields gives an "energy flux" representing the rate of fraction generation in the Stern-Brocot tree. High Poynting magnitude indicates regions where new fractions are being actively produced via mediants.
Interpretation: Just as electromagnetic energy flows from sources to sinks, "arithmetic energy" (fraction generation) flows from prime denominators through the mediant construction, filling the rational number line.
Prime "particles" create coprime "field quanta" (fractions). The totient function φ(m) acts as a coupling constant determining interaction strength.
Coprime density behaves like an incompressible fluid (∇·F = 0) flowing through the Stern-Brocot tree "pipe network" with prime sources.
Large primes create "potential wells" that concentrate nearby fractions, analogous to mass curving spacetime and bending light paths.
The circular ring visualization resembles diffraction from a circular aperture, with Farey gaps analogous to dark fringes in the interference pattern.
The zeros of the Riemann zeta function can be interpreted as "resonant frequencies" of the prime distribution field. The critical line Re(s) = 1/2 corresponds to the condition where the density wave equation has standing wave solutions.
This is analogous to how electromagnetic cavity modes have discrete frequencies—the prime distribution creates a "quantum cavity" in number space.
Note: This framework is exploratory and metaphorical. While the mathematical structures are rigorous, the "field theory" interpretation provides intuition rather than formal equivalence to electromagnetism.
Foundational works and resources underlying this exploration
"Variae observationes circa series infinitas" - Introduction of the totient function φ(n) and the product formula for ζ(s). Established the fundamental result that the density of coprime pairs is 6/π².
"Ein Beitrag zur analytischen Zahlentheorie" - Asymptotic formula for the summatory totient function: Σφ(n) = (3/π²)N² + O(N log N). This classical result underlies the interval counting analyzed here.
Letter to Philosophical Magazine describing the mediant property of Farey sequences. The sequence F_N of fractions p/q with 0 ≤ p ≤ q ≤ N and gcd(p,q) = 1 forms the basis of interval analysis.
First rigorous proof of the Farey sequence mediant property, establishing that between any two adjacent Farey fractions a/b and c/d, we have |ad - bc| = 1.
"Les suites de Farey et le problème des nombres premiers" - Demonstrated that RH is equivalent to: Σ|F_k - k/|F_N|| = O(N^(1/2+ε)) for any ε > 0.
Independent proof of the Franel connection, establishing Farey sequences as a geometric lens for viewing prime distribution and the Riemann Hypothesis.
Development of the Meissel-Lehmer algorithm for computing π(x), the prime counting function, in sublinear time. This work enables efficient computation of prime distributions used in our P/C analysis.
Independent discovery of the Stern-Brocot tree, a binary tree structure that generates all positive rationals exactly once in lowest terms. Our tree path visualization and audio playback use this structure.
Discovery that consonant musical intervals correspond to simple rational frequency ratios. The audio features in this tool map Farey fractions to harmonic intervals, connecting number theory to acoustic perception.
"Schreiben an Herrn Borchardt über die Theorie der elliptischen Modulfunktionen" - Introduction of the Dedekind eta function and Dedekind sums, connecting modular forms to number theory.
An Introduction to the Theory of Numbers (Oxford University Press) - Comprehensive treatment of Farey sequences, totient function, and continued fractions. Essential reference for theoretical foundations.
Concrete Mathematics (Addison-Wesley) - Detailed treatment of the Stern-Brocot tree and its algorithmic applications.
Exploratory work and visualizations:
This interactive explorer was developed using:
"Mathematics is the music of reason." — James Joseph Sylvester
This work bridges the visual, auditory, and analytical dimensions of number theory.
Comprehensive documentation for all features in the main visualization tool
The Farey Sequence Explorer visualizes coprime fractions r/m (where gcd(r,m)=1) organized into sectors based on their denominators. Each sector Sₙ contains fractions in the interval (1/(n+1), 1/n]. The tool computes exact counts, compares them to asymptotic predictions from the Basel problem (6/π²), and analyzes the distribution of prime/composite patterns in number theory.
Explore the complete suite of number theory visualization tools by @7dview
Enhanced Riemann Hypothesis verification with cosmic-scale testing, prime sieves, L-function analysis, and conjecture testing. Features modular rings, gap analysis, and zeta zero connections.
Geometric visualization of prime channel avoidance and composite projection. Demonstrates how prime moduli avoid Farey reduction channels while composites project onto them.
Interactive visualization of number-theoretic structures in ℤ/Mℤ. Shows coprime residues, reduction channels, and divisor lattices for composite moduli.
Comprehensive Farey sequence explorer with GCD analysis, primitive roots, quadratic residues, and modular arithmetic visualizations across 20+ tabs.
Hyperbolic geometry meets number theory. Farey fractions on unit circle with Cayley transforms, Möbius transformations, Smith charts, and prime distribution analysis.
Integrates music theory with number theory. Audio playback, consonance analysis, Stern-Brocot tree with musical intervals, and harmonic color modes.
12-canvas visualization suite for modular arithmetic. Connection modes, dyadic cardioids, distance tools, and comprehensive number theory analysis.
Massive 40+ canvas research platform. Primitive lattices, Möbius functions, coprime density shells, musical Stern-Brocot tree, and comprehensive number theory suite.