REVIEW 2 major objections 5 minor 7 references
The strange story of an almost unknown prime number counter: The Rafael Barrett formula
T0 review · 2 major / 5 minor · reviewed 2026-08-04 · deepseek-v4-flash
Pith's one-line read Rafael Barrett's 1903 trigonometric sum is an exact prime counter.
desk verdict A sound but historically minor note; the formula is correct, the proof has a small correctable gap, and the closing 'challenge' is a restatement of the prime number theorem. read the letter →
The pith
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
The reading
What carries the argument
The central object is the trigonometric indicator S(k) = floor( sin(pi (k-1)!/k) / sin(pi/k) ). Wilson's theorem is the engine: for prime k, (k-1)! ≡ -1 (mod k), which makes the numerator equal to sin(pi/k) in magnitude and sign, so S(k) = 1; for composite k ≥ 5, divisibility of (k-1)! by k makes the numerator zero, so S(k) = 0. Legendre's formula supplies the factorial-exponent calculation used in the appendix for the composite case. The leading constant 3 accounts for the primes 1, 2, and 3 under Barrett's convention.
What would settle it
Compute (k-1)! mod k for every k from 5 to 1000: the formula predicts S(k) = 0 for composites and S(k) = 1 for primes. The first composite with a nonzero residue, or the first prime where Wilson's congruence fails, would make Barr(n) miscount.
Extended reading notes
Core claim
Barrett's formula asserts that Barr(n) = 3 + sum_{k=5}^{n-1} floor( sin(pi (k-1)!/k) / sin(pi/k) ) equals the number of primes p < n, under the historical convention that 1 is counted as prime. The summand is a geometric indicator of primality: for composite k ≥ 5, (k-1)! is divisible by k, so the numerator's sine is zero; for prime k, Wilson's theorem forces the ratio to be 1. Thus every integer k contributes exactly 1 if k is prime and 0 otherwise, making the formula a finite, exact trigonometric expression for the prime-counting function.
Load-bearing premise
The formula's exactness assumes that for every composite k ≥ 5, the factorial (k-1)! is divisible by k; the appendix's demonstration of the prime-power subcase is sketched rather than fully shown, and in examples like k = 9 the relevant inequality is an equality, so this divisibility lemma is the part a reader must verify independently.
Editorial extensions
If this is right
- Barrett's formula gives an exact, finite trigonometric expression for the prime-counting function: for any n, one elementary term per integer suffices, with no sieve or search.
- The formula converts Wilson's theorem into a quantized counting statement: the congruence (k-1)! ≡ -1 (mod k) becomes a 0-or-1 integer contribution.
- Because the sum stops before n, the count is pointwise exact, not merely asymptotic, for every n.
- The open problem posed in the paper is whether an asymptotic expansion of this trigonometric sum can reproduce n/ln n, connecting the elementary formula to the prime number theorem's prediction.
Reading between the lines
- The same indicator construction could be adapted to count any integer set defined by a factorial divisibility condition, replacing Wilson's theorem with other congruences to generate analogous exact counters.
- As a practical counting device the formula is inefficient: forming (k-1)! modulo k up to n costs more work than standard sieves, so its value is conceptual and historical rather than computational.
- The paper's closing challenge is essentially the prime number theorem in disguise: showing that the sum of these 0-or-1 indicators is asymptotically n/ln n is equivalent to proving the standard asymptotic distribution of primes.
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The paper is a historical and expository note on a 1903 formula by Rafael Barrett, later analyzed by García de Zúñiga in 1935, which counts primes p < n (with 1 counted as prime). The formula is Barr(n) = 3 + sum_{k=5}^{n-1} floor( sin(π(k-1)!/k) / sin(π/k) ). The main claim is that this expression equals the number of primes below n. The paper gives examples, connects the formula to Wilson's theorem, and includes an appendix intended as a proof. The formula itself is correct, but the appendix's proof has a gap in the composite case and a missing parity justification in the prime case.
Significance. If the proof is completed, the paper is a pleasant historical/expository contribution to math.HO. The formula is an elementary curiosity rather than a new mathematical result, and its main interest is historical. The proof strategy is sound in outline and is not circular: it derives the formula from Wilson's theorem and trigonometric identities, with the constant 3 fixed by the primes 1, 2, 3 rather than fitted to data. The paper also honestly poses, without overclaiming, the question of whether an asymptotic limit can be taken. However, the appendix as written does not fully establish the composite-case divisibility on which the exactness of the count rests, so the central claim is not yet fully proven in the manuscript.
major comments (2)
- [Appendix, composite case (Eq. A2–A3)] The proof that every composite k ≥ 5 divides (k−1)! is incomplete and contains a false statement. The text splits into the cases p_i^{α_i} ≤ k−1 and p_i^{α_i} = k; for the latter it only says 'is shown for k ≥ 8' without giving the argument, and then claims that the Legendre sum (A2) is 'greater than' α_i. For k = 9, v_3(8!) = floor(8/3) + floor(8/9) = 2, which equals α_i, not greater. Equality is sufficient, but a complete proof is needed. For example, one can prove k | (k−1)! for composite k ≥ 5 by splitting k = ab with 1 < a ≤ b < k, and for prime powers p^a use v_p((p^a−1)!) = (p^a−1)/(p−1) − a ≥ a for p^a ≥ 8. This point is load-bearing because the vanishing of the summand for composite k is essential to the prime-counting property.
- [Appendix, prime case (Eq. A4–A5)] The proof asserts that the integer m = ((k−1)!+1)/k appearing in (A4)–(A5) is odd ('od an odd integer') but gives no justification. Wilson's theorem alone guarantees only that m is an integer. Oddness follows because (k−1)! is even for k ≥ 3 and k is odd, so m = odd/odd is odd, but this parity argument should be stated. If m were even, sin(mπ − π/k) would equal −sin(π/k) and the floor would be −1, so this is a necessary step in the proof that each prime term contributes exactly 1.
minor comments (5)
- [Eq. (1)] The prime-counting function is typeset as 'n(n)' rather than π(n); please correct.
- [Domain of Barr(n)] The paper does not specify for which n the formula is valid. As written, Barr(3)=3 but the primes p<3 counted with 1 are {1,2}; the formula requires n ≥ 4 (or n ≥ 5 if one wants the sum nonempty). Please state the intended domain.
- [Final question] The closing question asks for 'a limit to Barrett's formula that achieves asymptotic formula (1)' but does not define the notion of limit. Clarify whether this means pointwise convergence, asymptotic equivalence after a normalization, or a computational/complexity statement.
- [References and historical typos] Reference [5] has several typographical errors: 'Tenembaum' should be 'Tenenbaum', 'nombres premières' should be 'nombres premiers', and 'La Vallée Poissin' should be 'La Vallée Poussin'. Also check the article numbering for reference [3].
- [Appendix notation] The displayed version of Eq. (A2) is difficult to read; please ensure the floor notation and summation limits are typeset unambiguously. The derivation of the odd integer in the prime case would also be clearer if written as (k−1)!/k = m − 1/k with m explicitly defined.
Circularity Check
No significant circularity: the prime-counting formula is derived from Wilson's theorem and elementary sine identities, not from its own output.
full rationale
The paper's central claim is that Barr(n) = 3 + sum_{k=5}^{n-1} floor(sin(pi (k-1)!/k) / sin(pi/k)) counts primes p < n, counting 1 as prime. The derivation in the Appendix reduces each summand to a primality test: for prime k >= 5, Wilson's theorem gives (k-1)! + 1 ≡ 0 (mod k), so (k-1)!/k = od - 1/k with od odd, making sin(pi (k-1)!/k) = -sin(pi/k) and the ratio equal to 1; for composite k >= 5, the paper invokes the standard fact that k | (k-1)!, so the numerator is sin(pi * integer) = 0 and the term vanishes. The constant 3 is a fixed count for 1, 2, and 3, not a fitted parameter. No parameter is fitted to a subset of the counted primes, no result of the paper is used as its own premise, and no load-bearing self-citation appears; the cited prior work (García de Zúñiga [3]) is historical, not computational support for the formula. The only substantive issue is a proof gap in the appendix: for the prime-power case k = p^alpha, the Legendre-sum text says the sum is 'greater than' alpha_i, while equality would suffice and can fail for k = 9. This is an exposition/completeness flaw, not circularity: the divisibility lemma is true by elementary arguments and is independent of the formula being proved. Because the derivation is self-contained apart from standard theorems, the circularity score is 0.
Assumptions & free parameters
free parameters (1)
- small-prime offset =
3
assumptions (4)
- standard math Wilson's theorem: for prime p, (p-1)! ≡ -1 mod p.
- standard math Legendre's formula for the p-adic valuation of a factorial.
- standard math Trigonometric identities sin(a-b) and sine/cosine periodicity.
- domain assumption For every composite k >= 5, k divides (k-1)!.
Cite this review
Pith. "Pith review of The strange story of an almost unknown prime number counter: The Rafael Barrett formula." pith.science (2026). https://pith.science/paper/SXMCDNOL
@misc{pith2026250919324,
author = {Pith},
title = {Pith review of: The strange story of an almost unknown prime number counter: The Rafael Barrett formula},
year = {2026},
howpublished = {\url{https://pith.science/paper/SXMCDNOL}},
note = {Machine review of arXiv:2509.19324}
}
read the original abstract
In this brief article, we present the formula created by Rafael Barrett in 1903 in a note to Henri Poincar\'e, which remained unknown for decades. Discovered in the 1930s by a Uruguayan mathematician, this formula was published and analyzed in a journal published in Montevideo in 1935. In this study, we present Barrett's formula and analyze a challenge it could pose.
Figures
Reference graph
Works this paper leans on
-
[1]
Paraguayan Sorrow: Writings of Rafael Barrett, Monthly Review Press
Barrett, R (2024). Paraguayan Sorrow: Writings of Rafael Barrett, Monthly Review Press
2024
-
[2]
Mirando Vivir, (1912)
Barrett, R. Mirando Vivir, (1912). O.M. Bertani (editor) Montevideo (Kindle edition 2014)
1912
-
[3]
García de Zúñiga, E. (193 5). Rafael Barrett, Matemático, Boletín de la Facultad de Ingeniería, 30-32 (https://www.edu.uy/es/node/39537)
-
[4]
Massera, J. L. and Sheffer, J, J. (1966). Linear Differential Equations and Function Spaces, Academic Press, New York
1966
-
[5]
Tenembaum, G and Mendès France, M. (2014). Les nombres premières, entre l'ordre et le chaos, Dunod, Paris. APPENDIX: Proof of Barrett's formula We take the terms of the summation, (k 1)!sin k sin k (A1) and we analyze what happens if k is composite or if k is prime. Previously, let us remember the elementary properties of sin and cos: i...
2014
-
[6]
absorbed
k is composite In this case, the prime factors of k are in (k 1)! . Here follows the argument that proves this assertion. Let iikp . Legendre's formula allows us to determine the exponents of the prime factors of a factorial pi j j1 i k1v ((k 1)!) p , (A2) where each term is the integer part ("floor" function) of the displayed quoti...
-
[7]
We write it as follows: (k 1)! 1 1 [(k 1)! 1] 1 k k k
k is prime In this case, we analyze the quotient (A3). We write it as follows: (k 1)! 1 1 [(k 1)! 1] 1 k k k . (A4) But by Wilson's theorem, since k is prime, it is (k 1)! 1 0(mod k) k (where k means that is a multiple of k) . Therefore, equation (A4) can be expressed as follows: 1od k (A5) with od an odd integer. Let us now evaluate t...
Reviewed August 4, 2026 · model on record in the stance chip above.
Discussion (0). Continue with ORCID to comment.