Computational exploration of coprime pair distributions using classical summatory totient estimates
Mertens' totient formula applied to interval S_s = (1/(s+1), 1/s]
This visualization explores coprime fractions r/m within Farey sequence intervals (sectors). Each sector Sₛ = (1/(s+1), 1/s] contains fractions arranged in a circular ring, with colors indicating various mathematical properties.
| s | 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. Note: The bisection identity requires all sectors included, i.e. Sector Bound constant = 1. That is the default, so this verifies PASS on load. Narrowing the bound (< 1) truncates the right hand side and the check will report FAIL.
Legend Font Size Control
Computational analysis of deviations between exact enumeration and Mertens' asymptotic formula F(s,N) = 3N²/(π²s(s+1)) applied to intervals.
Periodicity diagnostic for the sector-residual sequence. Note this spectrum is indexed in cycles per sector index (range 0 to 0.5); it is not comparable to the imaginary parts of the zeta zeros, which are frequencies conjugate to log x. Detecting those would require log-spaced sampling, which this panel does not perform.
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 F(s,N) over all sectors s ≈ Σφ(m) (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_s = (1/(s+1), 1/s]. The asymptotic count F(s,N) ~ (3/π²)N²/(s(s+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_s = (1/(s+1), 1/s], we obtain:
Where F(s,N) counts coprime pairs (a,b) with 1 ≤ b ≤ N, gcd(a,b)=1, and a/b in S_s. This follows from classical totient summation.
Step 1: The geometric constraint a/b ∈ S_s = (1/(s+1), 1/s] translates to b/(s+1) < a ≤ b/n.
Step 2: For each denominator b, there are approximately b/(s(s+1)) integers a in this range.
Step 3: Restricting to coprime pairs: Σ_{b≤N} φ(b)/(s(s+1)) + O(N)
Step 4: Apply Mertens' classical summatory totient formula (1874):
Conclusion: F(s,N) = (1/(s(s+1))) * ((3/pi^2)N^2 + O(N log N))
| Sector s | Width 1/(s(s+1)) | Asymptotic Factor F(s,N)/N² | Numeric Value |
|---|---|---|---|
| 1 | 1/2 | 3/(2pi^2) | approximately 0.1520 |
| 2 | 1/6 | 3/(6pi^2) | approximately 0.0507 |
| 3 | 1/12 | 3/(12pi^2) | approximately 0.0253 |
| n | 1/(s(s+1)) | 3/(pi^2 s(s+1)) | approximately 0.3040/(s(s+1)) |
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.
Computational analysis shows that for any fixed N, there exists a transition point s* ≈ (√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.
This is an elementary threshold, not a signal-processing result — "Nyquist limit" doesn't literally apply here. The only resemblance is qualitative: a fixed-N formula stops resolving individual sectors once predicted counts drop below 1, the same shape as sampling below a Nyquist rate, with no deeper connection than that shape.
Condition: The predicted count F(s,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 | F(s,N) >> 1 | F(s,N) ≈ 1 | F(s,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 regime where (the name is descriptive only — no quantum mechanics involved):
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. (Written ι, not φ — throughout this page φ is reserved for Euler's totient.)
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 as many coprime fractions as the union of all remaining sectors S₂ ∪ S₃ ∪ S₄ ∪ ⋯ combined:
Theorem 1 equates two totals. The involution in fact matches S₁ against the rest one sector at a time. Label each fraction of S₁ by the sector of its reflection, sub‑sector k = ⌊m/(m−r)⌋. Then:
Summing these rows returns Theorem 1, so the refined form is strictly stronger: S₁ does not merely have the same total as the rest, it contains a piece matching every individual sector. The single deficit at k = 2 is the fixed point ι(1/2) = 1/2, which sits in S₂ and has no preimage in S₁ — the same orphan that makes Theorem 1 balance, now visible instead of cancelled.
Why the reflection index and not the second CF digit
Sector index is the first partial quotient a₁, so it is tempting to label sub‑sectors by the second, a₂. That is a different index: over all 24,338 coprime fractions of S₁ with m ≤ 400, ⌊m/(m−r)⌋ = a₂ + 1 in every case and the two are never equal. Indexing by a₂ shifts every row by one and the identity reads as |S₁,ₖ| = |Sk+1|, which looks like a mismatch. The reflection index is used here so sub‑sectors line up with sectors by name.
The subdivision is applied to S₁ only, at one level. Descending further would need a labelling convention for sub‑sectors of S₁,ₖ that has not been established, and no unverified index is put on the page.
The involution ι(r/m) = (m−r)/m pairs S₁ with the rest almost perfectly, and the two leftover points cancel exactly:
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). Gaps therefore 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 |
|---|
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 | s | s(h,k) | 12k*s(h,k) | gcd |
|---|
| h | s | 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 F(s,N) ~ (3/π²)N²/(s(s+1)) as a 3D cone surface. The vertical axis represents sector number s, 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/s².
| 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 (exact) | Per Class Avg | χ² / χ²₀.₉₅ | Uniform? |
|---|
Overview: This module implements sublinear algorithms for prime counting and totient summation. Sublinear prime counting. The Lucy_Hedgehog method used here runs in O(x^(3/4)); the O(x^(2/3)) bound belongs to Lagarias–Miller–Odlyzko (1985), a later refinement of Meissel (1870) and Lehmer (1959), and is not implemented on this page. 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 Ss = (1/(s+1), 1/s] is bounded by:
The Gatekeeper 2/(2s+1) is the mediant of these boundaries.
Key insight: Mediants generated within a sector stay confined to that sector.
If a/b ∈ Ss and we take mediants with the sector boundaries, all descendants remain in Ss.
The Stern-Brocot subtree rooted at the Gatekeeper generates exactly the fractions strictly between the boundaries — that is, Ss ∩ FN minus the right endpoint 1/s, which belongs to Ss but sits on the boundary as an ancestor of the subtree.
| N | |F_N| | Σ|δ| | Σ|δ|/√N | Max Gap | Mean Gap |
|---|
Foundational works and resources underlying this exploration
"Variae observationes circa series infinitas" (1737) - The Euler product formula connecting ζ(s) to the primes. Euler later introduced the totient function φ(n) in "Theoremata arithmetica nova methodo demonstrata" (1763). The coprime-density result 6/π² itself came later, via Dirichlet (1849), Mertens (1874), and Cesàro (1881).
"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 unimodularity (neighbour) property, establishing that between any two adjacent Farey fractions a/b and c/d we have |ad − bc| = 1. Distinct from the mediant property, which concerns (a+c)/(b+d).
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/(s+1), 1/s]. 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.