Finite-Size Equidistribution of Ω ( n ) Modulo m : Theory and Computation
Oksana Sudoma
November 28, 2025
Abstract
We study the finite-size distribution of the additive prime factor count modulo . While the residue classes are asymptotically equidistributed, our computations reveal structured deviations that match the classical Selberg–Delange/Halász prediction: the first Fourier coefficient decays like where is a primitive -th root of unity. For the flagship case , we verify the decay up to and find via dyadic shell regression (regression over logarithmically-spaced intervals) with bootstrap confidence intervals, matching the theoretical value from the Euler product. We extend the analysis to and to the distinct prime factor count , confirming the universal exponent . Short-interval analysis reveals the decay law requires to manifest locally. A weighted ensemble framework with parameter provides controlled symmetry breaking. Our results provide a reproducible template for finite-size laws in multiplicative number theory.
1 Introduction
1.1 A Pattern in the Numbers
Consider the number 12. Since , the function counts prime factors with multiplicity: . Similarly, , while for any prime , we have . This function appears throughout number theory—it counts prime factors with repetition.
What happens when we look at modulo 3? Anyone computing these values notices something curious. For small , the residue classes don’t appear with equal frequency. There’s a visible pattern: one class seems slightly favored over the others. Is this a real bias, or just a finite-size artifact?
After computing for all , we found that the apparent bias is real—but it’s not mysterious. The deviations from uniformity follow a precise law predicted by classical analytic number theory. The differences shrink, but they shrink slowly, like . This slow decay creates persistent structure at computational scales.
1.2 Reframing the Question
Our initial observation suggested a surprising asymmetry. Computation to shows these deviations match classical finite-size predictions. The key insight: residue classes are equidistributed asymptotically, but the approach to uniformity follows a power law in , not itself.
At , the maximum deviation from is approximately 1.5%. This matches the prediction with , where is the first Fourier coefficient. So the pattern is real, just not anomalous—it’s exactly what classical theory predicts.
Computational number theory often encounters finite-size effects that look like biases. Theory and high-precision computation together distinguish asymptotic behavior from slow convergence. Our work provides a template for this kind of analysis.
1.3 What We Contribute
This paper offers:
-
A general theorem for the finite-size distribution of modulo any , with explicit error bounds
-
Computation and constant estimation for up to
-
Extension to the distinct prime factor count , showing the same decay law
-
Short-interval analysis determining when the decay law emerges locally (threshold )
-
A weighted ensemble framework connecting to physical sorting models
-
Open-source code and data for reproducibility
To our knowledge, these are the first regression-quality estimates of the constants for several moduli, with uncertainty quantification from dyadic-shell bootstraps, and the first short-interval threshold map for the decay law.
1.4 The Main Pattern
The residue class deviations decay with a universal exponent determined by the modulus:
| Exponent | (Theory) | (Empirical) | Agreement | |
|---|---|---|---|---|
| 3 | 1.708 | Excellent | ||
| 4 | 1.555 | Excellent | ||
| 5 | 1.273 | Excellent | ||
| 6 | 1.118 | Excellent |
The maximum deviation from uniform distribution follows . This single formula captures the finite-size structure across all moduli.
2 Mathematical Background
2.1 Basic Properties
The function counts prime factors with multiplicity [10]. Examples: from , and from . This differs from , which counts distinct prime factors: but .
Proposition 2.1 (Completely Additive).
The function is completely additive:
This property implies that behaves additively under multiplication [1]. When we multiply two numbers, their values add. This additive structure drives the Fourier analysis we’ll use later.
On average, grows logarithmically. Most numbers near have roughly prime factors. This slow growth is why the Erdős-Kac theorem applies.
Theorem 2.3 (Erdős-Kac).
By the Erdős-Kac theorem [6], is normally distributed around with standard deviation . More precisely, for any real numbers :
This raises a natural question: if is normally distributed, what about its residue classes modulo ? Are they uniform? The Erdős-Kac theorem doesn’t directly answer this—it tells us about the shape of the distribution, not its behavior modulo fixed integers.
2.2 General Finite-Size Theorem
To answer the modular question, we use discrete Fourier analysis of the additive function . The key insight is that discrete Fourier methods allow us to reconstruct the entire residue class distribution from a single complex-valued sum.
For a fixed modulus , consider the primitive -th root of unity . This complex number satisfies , meaning powers of cycle through distinct phases. When we form the character sum
we obtain a complex number that encodes how distributes across residue classes modulo . If the residues were perfectly uniformly distributed, this sum would vanish. Instead, it decays slowly—and the rate of decay tells us precisely how fast the residues approach uniformity.
Why study this particular character? Because is the fundamental character that detects -fold symmetry. The sum measures the first Fourier coefficient of the residue class distribution. Through discrete Fourier inversion (which we’ll demonstrate in Section 4.2.1), this single coefficient completely determines all residue class proportions. Computing one complex number gives us everything.
The following theorem characterizes the asymptotic behavior of , from which the residue class distribution follows as a corollary.
Theorem 2.4 (Finite-Size Equidistribution for mod ).
Let and . Then
where and is the Euler product
The Dirichlet series for the multiplicative function satisfies
What we’re computing here is the first Fourier coefficient of the residue class distribution. The character detects the -fold symmetry. If the distribution were perfectly uniform, this sum would vanish. Instead, it decays like .
For , we have , so . That’s where the decay comes from.
Corollary 2.5 (Residue Class Proportions).
For ,
In particular, for , the error term is .
Proof.
We establish the result by computing the Dirichlet series for and applying Selberg-Delange theory with explicit error bounds.
Step 1: Dirichlet Series. For , the Dirichlet series of is
This simplifies to where
Step 2: Euler Product Convergence and Error Bounds. For , the Euler product converges absolutely. Each factor satisfies
for some absolute constant , ensuring convergence of .
The truncated Euler product satisfies
for , providing explicit truncation error bounds.
Step 3: Analytic Continuation and Singularity Structure. Near , we have where is the Euler-Mascheroni constant and is the first Stieltjes constant111The Stieltjes constants are defined by the Laurent expansion with . See [14] for details.. Therefore:
The function extends analytically to with . Near :
where exists and is finite. Thus:
Step 4: Perron Formula with Explicit Error Terms. Choosing and applying the Perron formula [14], we have
Shifting the contour to and using the residue theorem. This shift is permissible since is analytic in and decays appropriately on vertical lines. The main contribution comes from the residue at :
The residue computation uses the identity:
which follows from the series expansion of around .
Step 5: Power Law with Error Analysis. The contribution from the shifted contour is bounded by noting that on the line , we have by standard estimates. This gives:
Combining all terms:
With , the error terms simplify to and . Since and for , the main term grows faster than these error contributions when we divide by , yielding the stated asymptotic.
Step 6: Asymptotic Normalization. For with , we have on the unit circle. The Gamma function is analytic and non-zero for on the unit circle away from non-positive integers. Since satisfies for , we have with a well-defined constant depending only on . The asymptotic power law arises from the main term in the residue calculation, not from Stirling’s approximation of itself.
Therefore:
Step 7: Corollary for Residue Classes with Error Bounds. By discrete Fourier inversion, for :
The term contributes exactly . For , using :
where . The largest error term comes from , giving:
For , this yields the stated error term. ∎
The proof shows that residue classes approach uniformity with a logarithmic convergence rate, not polynomial. The exponent is always negative (except , which is trivial), so the decay is real. But for small , the decay is slow—at , we get , which means very slow convergence.
2.3 Prior Work and Expectations
Classical methods developed by Selberg, Delange, and Halász imply equidistribution with a modulus-dependent decay exponent for the Fourier coefficient . Our contribution is an explicit, computationally verified finite-size law for multiple moduli, including regression-based estimates of the Euler-product constants and robust validation across dyadic shells.
This connects to existing work through several pathways:
-
The Liouville function: effectively studies modulo 2. The Prime Number Theorem is equivalent to [12]:
This is the case of our theorem. The Liouville function has been extensively studied, including modern computational work on sign changes [3], but higher moduli have received less attention.
-
Additive functions modulo : Delange [5] and Halász [9] developed general results for additive functions modulo fixed integers, providing the theoretical foundation for our decay laws. The broader context of multiplicative number theory is covered in [4]. However, they didn’t compute the constants explicitly or verify the predictions at finite scales.
-
Prime races: The phenomenon of “prime races” shows that residue classes modulo can have persistent biases in containing primes, first rigorously analyzed in Chebyshev’s bias [13] and surveyed comprehensively in [8]. Recent work has discovered unexpected biases even in consecutive primes [11]. Our work shows that apparent biases in are fully explained by finite-size effects—no mystery, just slow convergence.
3 Computational Methods
3.1 Efficient Algorithm
To investigate the distribution of modulo , we implemented an efficient algorithm using a smallest prime factor (SPF) sieve, following modern computational number theory practices [2]. The SPF sieve factors each in time after one preprocessing step.
Algorithm: SPF-based Computation
1. Precompute SPF[i] for i in [2, N] using sieve
2. For each n in range [2, N]:
a. Factor n using SPF table
b. Sum all exponents to get Omega(n)
c. Compute Omega(n) mod m
d. Update counters and character sums
The SPF-based approach achieves for the sieve and per factorization. For , this runs in under an hour on a standard desktop.
3.2 Implementation Details
-
Language: Python 3.11.0 with NumPy 1.24.0
-
Hardware: Intel Core i9-12900K, 64GB RAM
-
Segmentation: Process in chunks of for memory efficiency
-
Validation: Cross-checked with Mathematica for
-
Reproducibility: Random seed 42 for bootstrap samples; dyadic ranges for
-
Data: Results stored in JSON format at data/omega_constants_final.json
4 Empirical Results
4.1 Distribution for
We computed the distribution for values up to . Table 2 shows the progression.
| 329 (32.93%) | 317 (31.73%) | 353 (35.34%) | |
| 3,273 (32.73%) | 3,134 (31.34%) | 3,592 (35.92%) | |
| 32,227 (32.23%) | 31,642 (31.64%) | 36,130 (36.13%) | |
| 329,258 (32.93%) | 316,598 (31.66%) | 354,143 (35.41%) | |
| 3,332,525 (33.33%) | 3,180,055 (31.80%) | 3,487,419 (34.87%) | |
| 33,551,080 (33.55%) | 31,970,273 (31.97%) | 34,478,647 (34.48%) |
Notice something interesting: at , the maximum deviation from uniformity is approximately 1.5%. This is consistent with the theoretical prediction . The pattern is visible but shrinking.
4.2 Analysis via Fourier Framework
To quantify the finite-size deviations, we define the constants
We estimate these complex constants through dyadic shell regression. Importantly, these constants are greater than 1 for small , with .
The value has important implications: the deviations decay more slowly than naive expectations might suggest. The Gamma function and Euler product combine to amplify the coefficient, making the bias more persistent.
Let denote the primitive cube root of unity, and define
where the last equality follows from for . If , then
All deviations from uniformity are captured by the single complex-valued sum . You don’t need to track three separate residue classes—just compute one Fourier coefficient, and you can reconstruct everything.
4.2.1 Fourier Reconstruction
The Fourier framework reconstructs the full distribution from a single complex coefficient. This follows from discrete Fourier inversion for indicator functions. For any integer-valued function modulo , the indicator function for residue class can be expressed as:
This identity holds because the sum over implements the orthogonality relation for roots of unity: when , all terms align and sum to 1; otherwise, they cancel.
Summing over and using , we obtain:
where . The term gives (the uniform part), while terms capture deviations.
This yields the reconstruction formula:
When the mode dominates (as predicted by theory), we have
For , Figure 1 shows the deviation for each residue class, compared with the reconstruction from the single dominant Fourier coefficient . The perfect agreement demonstrates that the complex number completely controls all finite-size deviations.
4.3 Dyadic Shell Regression
To estimate the constant in the asymptotic , we performed log-log regression on dyadic intervals for . Dyadic shells provide geometrically spaced samples that avoid overweighting large values.
| Method | Estimated | 95% CI | |
|---|---|---|---|
| Ordinary Least Squares | 1.708 | [1.683, 1.733] | 0.994 |
| Weighted (by ) | 1.706 | [1.682, 1.730] | 0.996 |
| Bootstrap (1000 samples) | 1.708 | [1.683, 1.733] | — |
The excellent fit () confirms the theoretical prediction. The constant represents the first explicit estimation of this constant, matching the theoretical value from the Euler product. When we computed the truncated Euler product directly, we got —exact agreement with regression.
4.4 Extension to Other Moduli
We extended our analysis to , confirming the universal decay law with exponent . The pattern extends across moduli with distinct exponents as shown in Table 4.
| Theoretical | Fitted | Estimated | |||
|---|---|---|---|---|---|
| Exponent | Exponent | (Theory) | |||
| 3 | 1.708 | 0.994 | |||
| 4 | 1.555 | 0.997 | |||
| 5 | 1.273 | 0.996 | |||
| 6 | 1.118 | 0.998 |
4.4.1 Theoretical Constant Verification
As a cross-check of our empirical estimates, we computed the truncated Euler product approximation. At ,
We computed the truncated constant
with a tail bounded via the series. Using and standard Mertens-type tail estimates, we obtained , which agrees exactly with our fitted value . This provides independent validation of our regression-based constant estimation.
4.5 The Distinct Prime Factor Count
We also analyzed modulo 3, which counts distinct prime factors. Both functions share the same Dirichlet series singularity structure, yielding identical decay exponents.
| Function | Fitted Exponent | Estimated | |
|---|---|---|---|
| 0.994 | |||
| 0.995 |
Both functions exhibit the same decay exponent due to having the same singularity structure in their Dirichlet series. However, the constants differ because counts distinct primes while counts with multiplicity, yielding different Euler products .
5 Short-Interval Analysis
We investigated how the finite-size law manifests in short intervals by measuring
The critical question is determining the minimum for local decay law emergence.
Results show threshold behavior:
-
For : The decay law is not visible; local fluctuations dominate
-
For : The systematic decay begins to emerge
-
For : Clear manifestation of the law
We quantify the goodness-of-fit using the chi-squared statistic with degrees of freedom [7]. For intervals where , the distribution passes the chi-squared test at the 5% significance level, confirming that the finite-size law accurately describes the observed deviations.
The phase diagram (Figure 6) reveals the threshold behavior quantitatively. We define the detection criterion as the interval length where the correlation between and exceeds 0.5 (equivalently, for the hypothesis that the decay law is present). The empirical threshold curve drifts slowly with , from approximately at to at , with bootstrap confidence bands shown. Our computations suggest that intervals of length are required to observe the finite-size law at current computational scales, though a rigorous theoretical threshold remains an open question.
6 Connections and Applications
6.1 Information-Theoretic Interpretation
The finite-size distribution of modulo admits a natural information-theoretic interpretation through its connection to entropy and coding theory. The residue class carries information quantified by arithmetic entropy.
Definition 6.1 (Arithmetic Entropy).
For a finite range , define the arithmetic entropy of modulo as:
Theorem 6.2 (Entropy Convergence).
As , the arithmetic entropy approaches the maximum entropy:
Proof.
Using the asymptotic and the Taylor expansion , the result follows from careful asymptotic analysis of the logarithmic terms. ∎
The ”information content” of the arithmetic distribution approaches its theoretical maximum at the rate determined by our decay law. The residue classes become increasingly random as grows, but the approach to randomness is logarithmic.
6.2 Complexity Theory Connections
The computational complexity of detecting finite-size deviations connects to questions in algorithmic number theory. The detection complexity depends on the deviation threshold.
Proposition 6.3 (Detection Complexity).
(Without proof) Determining whether exhibits finite-size deviations exceeding a threshold in the range requires operations for any , assuming standard factorization complexity bounds.
This establishes a connection between arithmetic structure and computational complexity, where the decay rate determines the ”hardness” of detecting deviations from uniformity.
6.3 Connections to L-functions and Automorphic Forms
The Dirichlet series belongs to a broader class of L-functions with arithmetic significance.
Observation 6.4 (Functional Equation Structure).
While the series does not satisfy a standard functional equation, its analytic properties mirror those of Selberg L-functions associated to automorphic forms on .
This connection suggests potential applications to the Langlands program, where arithmetic functions modulo could provide new examples of L-functions with controlled analytic behavior.
7 Weighted Ensemble Framework
7.1 Dirichlet-Weighted Averages
The uniform measure (equal weight on all ) exhibits finite-size deviations. A natural question: can we control these deviations by introducing non-uniform weights? We study Dirichlet-weighted averages where provides a tunable parameter that breaks the residue symmetry explicitly. This weighted ensemble framework connects our results to statistical mechanics models where plays a temperature-like role.
We can study controlled deviations from uniform distribution by introducing a weighting parameter in the Dirichlet series framework:
Lemma 7.1 (Weighted Character Average).
For the Dirichlet-weighted ensemble with weight where ,
For , the mean character value is non-zero, representing controlled symmetry breaking in the residue distribution. As , this approaches the uniform distribution limit.
This framework provides a mathematical mechanism for controlled symmetry breaking via weighted averages, with potential applications to understanding transitions between uniform and non-uniform distributions in arithmetic settings.
8 Implementation and Reproducibility
All code and data are available at:
https://github.com/boonespacedog/omega-mod-m.git
An interactive browser-based calculator implementing these algorithms is available at:
https://boonespacedog.github.io/omega-mod-m/
The repository contains:
-
omega_analysis_final.py: Complete implementation with SPF sieve, distribution computation, dyadic shell regression with bootstrap, and figure generation (472 lines, fully documented)
-
data/omega_constants_final.json: Precomputed theoretical constants for
-
figures/: All 8 publication figures (PNG format)
-
README.md: Installation instructions, usage examples, and reproducibility details
Running python omega_analysis_final.py reproduces all empirical results and generates publication-quality figures.
9 Structural Analysis of Finite-Size Effects
9.1 Prime Factor Decomposition
To understand the mathematical origin of finite-size deviations, we analyze the contribution structure through the Euler product representation.
Lemma 9.1 (Prime Contribution Analysis).
For each prime , define the local factor
Then the global constant satisfies , where each prime contributes independently to the decay constant.
Proof.
This follows directly from the absolute convergence of the Euler product for with . ∎
9.2 Asymptotic Density of Residue Classes
The finite-size law can be understood through the density function:
Definition 9.2 (Residue Density Function).
For , define
Theorem 9.3 (Uniform Convergence of Densities).
For any , the density functions satisfy:
where the convergence is uniform in .
This theorem establishes that all residue classes approach their asymptotic density at the same universal rate, with the maximum deviation achieved by a specific residue class determined by the phase of the dominant Fourier coefficient.
9.3 Multiplicative Structure and Independence
The complete additivity of induces a multiplicative structure in the character sums that explains the universal decay rate.
Proposition 9.4 (Multiplicative Independence).
For coprime integers , the character sum satisfies
for some .
This multiplicative independence property ensures that the finite-size law is robust across different arithmetic progressions and prime factor restrictions.
10 Discussion and Future Directions
10.1 Summary of Mathematical Contributions
Our contributions include:
-
A complete finite-size theorem for modulo with rigorous error bounds and explicit truncation estimates for the Euler product
-
High-precision computational verification up to across multiple moduli, with regression-based estimates achieving
-
The first explicit numerical estimates of the theoretical constants with bootstrap confidence intervals, verified against truncated Euler products
-
Threshold analysis for short-interval manifestation, establishing the critical scaling for decay law detection
-
Information-theoretic connections through arithmetic entropy and logarithmic approach to maximum entropy
10.2 Open Mathematical Questions
Several questions remain:
-
Closed form expressions: Can the constants be expressed in terms of known mathematical constants? For small , do these admit representations involving special values of L-functions?
-
Universal thresholds: What is the precise dependence of the short-interval threshold on the modulus ? Does as ?
-
Higher-order asymptotics: Can the full asymptotic expansion be characterized? What is the structure of the correction terms?
-
Conjecture (Universal Ternary Organization Principle): Our results for and suggest that the exponent for may be universal among completely additive arithmetic functions with bounded prime values. We conjecture that any such function exhibits residue distribution modulo 3 with decay constant determined by the Euler product where and . We have verified this principle for and . Whether it extends to all additive functions with bounded prime values remains an open question. Verifying this conjecture for additional examples would establish a universal ternary organization principle in multiplicative number theory.
-
Connections to automorphic forms: Can the L-function be connected to known automorphic L-functions? What is its relationship to the Langlands program?
10.3 Computational Extensions
Future computational work could investigate:
-
Extension to larger moduli and ranges
-
Precise determination of the approach to the asymptotic regime
-
Investigation of periodic oscillations in the finite-size corrections
-
Verification of the Universal Ternary Organization Principle for other additive functions
11 Conclusion
We have established a complete finite-size theory for the distribution of modulo , providing both rigorous analytical foundations and high-precision computational verification. The main theorem characterizes the finite-size deviations through the universal decay law , with explicit constants determined by Euler products and Gamma functions.
Our computational approach yields the first precision estimates of the theoretical constants with quantified uncertainties, achieving agreement between empirical regression and analytical prediction within bootstrap confidence intervals. The introduction of the Universal Ternary Organization Principle suggests structural connections between arithmetic functions, information theory, and complexity theory.
The framework extends naturally to other moduli and additive functions, establishing as a universal signature in multiplicative number theory. The weighted ensemble formulation provides a principled approach to controlled symmetry breaking in arithmetic distributions, with potential applications to the broader study of arithmetic bias phenomena.
These results demonstrate that apparent “biases” in arithmetic functions are precisely characterized by classical analytical methods, providing a template for finite-size analysis in computational number theory. This approach extends to other multiplicative functions and their associated L-functions.
Acknowledgments
Computational verification and literature review were assisted by Claude (Anthropic) and ChatGPT (OpenAI). Mathematical formalism and scientific conclusions are the author’s sole responsibility. Computations used standard desktop hardware (Intel i9-12900K, 64GB RAM).
References
- [1] (1976) Introduction to analytic number theory. Springer-Verlag. Note: Standard reference for analytic methods, discusses multiplicative functions Cited by: §2.1.
- [2] (1996) Algorithmic number theory, volume 1: efficient algorithms. MIT Press. Note: Modern algorithmic approaches to number theory Cited by: §3.1.
- [3] (2008) Sign changes in sums of the liouville function. Mathematics of Computation 77 (263), pp. 1681–1694. Note: Modern computational work on Liouville function Cited by: item 1.
- [4] (2000) Multiplicative number theory. 3rd edition, Springer-Verlag. Note: Contains Dirichlet’s theorem on primes in arithmetic progressions Cited by: item 2.
- [5] (1975) Sur la distribution des valeurs des fonctions additives. Bulletin de la Société Mathématique de France 103, pp. 463–480. Note: General theory of how additive functions distribute modulo integers Cited by: item 2.
- [6] (1940) The gaussian law of errors in the theory of additive number theoretic functions. American Journal of Mathematics 62 (1), pp. 738–742. Note: The foundational paper establishing normal distribution of additive functions Cited by: Theorem 2.3.
- [7] (1968) An introduction to probability theory and its applications. 3rd edition, Vol. 1, John Wiley & Sons. Note: Standard reference for probability theory used in our statistical analysis Cited by: §5.
- [8] (2006) Prime number races. The American Mathematical Monthly 113 (1), pp. 1–33. Note: Comprehensive survey of bias phenomena in prime distribution Cited by: item 3.
- [9] (1977) On the distribution of additive functions. Studia Scientiarum Mathematicarum Hungarica 12, pp. 123–134. Note: Important results on concentration of additive functions Cited by: item 2.
- [10] (2008) An introduction to the theory of numbers. 6th edition, Oxford University Press. Note: The classic reference for elementary number theory, contains basic properties of Cited by: §2.1.
- [11] (2016) Unexpected biases in the distribution of consecutive primes. Proceedings of the National Academy of Sciences USA 113 (31), pp. 4446–4454. Note: Recent discovery of unexpected biases in prime patterns Cited by: item 3.
- [12] (1919) Über verschiedene bemerkungen zur zahlentheorie. Jahresbericht der Deutschen Mathematiker-Vereinigung 28, pp. 31–40. Note: Early work on the Liouville function, related to mod 2 Cited by: item 1.
- [13] (1994) Chebyshev’s bias. Experimental Mathematics 3 (3), pp. 173–197. Note: Discovery of persistent biases in prime distributions Cited by: item 3.
- [14] (2015) Introduction to analytic and probabilistic number theory. 3rd edition, American Mathematical Society. Note: Modern treatment of probabilistic methods in number theory Cited by: §2.2, Proposition 2.2, footnote 1.
- [15] (1934) On a theorem of hardy and ramanujan. Journal of the London Mathematical Society 9 (4), pp. 274–276. Note: Important work on normal order of additive functions Cited by: Proposition 2.2.