Let $a(n)=\sum_{k\le n}\varphi(\lfloor n/k\rfloor)$ (OEIS A317625) and $E(n)=a(n)-\frac{6}{\pi^2}n\log n$. Zhai (2020) proved $E(n)=O\big(n(\log n)^{2/3}(\log\log n)^{1/3}\big)$ and showed that $E(n)=\Omega(n)$. We prove $E(n)=\Omega_\pm(n\log\log n)$. There is an absolute constant $c>0$ such that $E(n)\le -c\,n\log\log n$ for infinitely many $n$, and $E(n)\ge c\,n\log\log n$ for infinitely many $n$. The proof averages over $n=Qt$ and $n=Qt-1$ with $Q=\big(\prod_{p\le z}p\big)^5$. For each $k$ we compute exactly the average over $t$ of $\varphi(m)/m$ at $m=\lfloor n/k\rfloor$; it is a product of local factors and a short sum depending only on the reduced fraction $Q/k=a/b$. The terms with $k\mid Q$ ($b=1$) deviate from $6/\pi^2$ by a fixed amount in a fixed direction, and their weights $1/k$ add up to $\sigma_{-1}(Q)\gg\log\log n$. The terms with $b\ge 2$ can deviate the other way. We bound their total by $\sigma_{-1}(Q)\cdot C$, where $C\le 0.2593$ when $n=Qt$ and $C\le 0.1061$ when $n=Qt-1$. These constants come from a finite computation in exact rational arithmetic with an explicit analytic tail. Both are smaller than the main deviations, which are about $0.51$ and $0.38$.
Let a(n)=∑k≤nφ(⌊n/k⌋) (OEIS A317625) and E(n)=a(n)−π26nlogn. Zhai (2020) proved E(n)=O(n(logn)2/3(loglogn)1/3) and showed that E(n)=Ω(n). We prove E(n)=Ω±(nloglogn). There is an absolute constant c>0 such that E(n)≤−cnloglogn for infinitely many n, and E(n)≥cnloglogn for infinitely many n. The proof averages over n=Qt and n=Qt−1 with Q=(∏p≤zp)5. For each k we compute exactly the average over t of φ(m)/m at m=⌊n/k⌋; it is a product of local factors and a short sum depending only on the reduced fraction Q/k=a/b. The terms with k∣Q (b=1) deviate from 6/π2 by a fixed amount in a fixed direction, and their weights 1/k add up to σ−1(Q)≫loglogn. The terms with b≥2 can deviate the other way. We bound their total by σ−1(Q)⋅C, where C≤0.2593 when n=Qt and C≤0.1061 when n=Qt−1. These constants come from a finite computation in exact rational arithmetic with an explicit analytic tail. Both are smaller than the main deviations, which are about 0.51 and 0.38.
1. Introduction
Bordellès, Dai, Heyman, Pan and Shparlinski [BDHPS] asked for the asymptotic behaviour of ∑n≤xφ(⌊x/n⌋) and conjectured
n≤x∑φ(⌊nx⌋)∼π26xlogx.
Wu [Wu] sharpened their bounds. Zhai [Zh] proved the conjecture in the form
n≤x∑φ(⌊nx⌋)=π26xlogx+O(x(logx)2/3(loglogx)1/3),
and, according to Ma and Wu [MW, §1], he showed that the error term is Ω(x). The sum over real x equals a(⌊x⌋), and the main terms at x and at ⌊x⌋ differ by O(logx). So it suffices to work with integers n and the sequence a(n) of OEIS A317625.
For the classical sum ∑m≤xφ(m)=π23x2+R(x), Montgomery [Mo] proved R(x)=Ω±(xloglogx) and conjectured that xloglogx is the true order. For the floor-function sum, the arithmetic of n itself gives a direct handle on the error.
Theorem 1. There is an absolute constant c>0 such that
E(n)≤−cnloglognandE(n)≥cnloglogn
each hold for infinitely many positive integers n. In particular E(n)=O(n).
The mechanism is simple. If n is divisible by Q=(∏p≤zp)5 and k∣P(z)4, then ⌊n/k⌋=n/k is divisible by every prime p≤z, so φ(m)/m at m=⌊n/k⌋ is at most ∏p≤z(1−1/p). This is far below the mean value 6/π2. The weights 1/k over k∣P(z)4 add up to σ−1(P(z)4)≥σ−1(Q)/ζ(5), which is of order logz≍loglogn. If instead n≡−1(modQ), then for the same k the number ⌊n/k⌋=(Q/k)t−1 is coprime to every p≤z, and the deviation goes the other way. The other divisors of Q never push in the opposite direction. The difficulty is the terms with k∤Q. For these, ⌊n/k⌋ is not determined by Q, and the deviation can have either sign. We compute their average over t exactly (Lemma 4) and bound the unfavourable part uniformly (Lemmas 5 and 6).
Notation.
g(m)=φ(m)/m=∑d∣mμ(d)/d.
σ−1(Q)=∑e∣Q1/e and P(z)=∏p≤zp.
πz=∏p≤zp+1p and μz=∏p≤z(1−p−2).
Implied constants are absolute unless stated otherwise.
2. Reduction to a weighted mean of g(⌊n/k⌋)
Let K=⌊n⌋ and split a(n)=A1(n)+A2(n) according to k≤K or k>K.
Lemma 1.A2(n)=π23nlogn+O(n).
Proof.
For k>K we have m=⌊n/k⌋≤M:=⌊n/(K+1)⌋<n.
For m<M, the number of k with ⌊n/k⌋=m is ⌊n/m⌋−⌊n/(m+1)⌋=m(m+1)n+O(1). For m=M, the number of k>K with ⌊n/k⌋=M is ⌊n/M⌋−K=O(1).
Hence A2(n)=n∑m≤Mm(m+1)φ(m)+O(∑m≤Mφ(m)), and the error is O(M2)=O(n).
We have ∑m≤Mφ(m)/m2=π26logM+O(1) and ∑mφ(m)/(m2(m+1))<∞. Since logM=21logn+O(1), the claim follows. □
Lemma 2.A1(n)=n∑k≤Kg(⌊n/k⌋)/k+O(n).
Proof. Write m=⌊n/k⌋=n/k−θ with 0≤θ<1. Then φ(m)=(n/k)g(m)−θg(m). Since 0≤g≤1, the errors add up to at most K. □
Since ∑k≤K1/k=21logn+O(1), Lemmas 1 and 2 give
E(n)=nD(n)+O(n),D(n):=k≤n∑kg(⌊n/k⌋)−6/π2.(2.1)
Theorem 1 therefore follows if D(n)≤−cloglogn and D(n)≥cloglogn each hold for infinitely many n.
3. Averaging over an arithmetic progression
Fix c∈{0,−1}, an integer Q≥1 and T≥Q. Let t run over T<t≤2T and put n=Qt+c. Let K0=⌊QT⌋. Since ∣g−6/π2∣≤1 and ∑K0<k≤2QT1/k=O(1), we have
D(Qt+c)=k≤K0∑kg(⌊(Qt+c)/k⌋)−6/π2+O(1).(3.1)
For each k we use the following notation.
e=gcd(k,Q), a=Q/e and b=k/e, so that Q/k=a/b in lowest terms.
S is the set of prime factors of a. Since gcd(a,b)=1, no prime of S divides b.
hS(j)=∏p∈S,p∣j(1−1/p) for j≥1, and hS(0)=∏p∈S(1−1/p).
μS=∏p∈S(1−p−2).
Lemma 3 (periodic density). Let d be squarefree, d1=gcd(d,a) and d2=d/d1. Then 1[d∣⌊(Qt+c)/k⌋] is periodic in t with period bd2, and its mean over one period is
ρc(d)=d21⋅bNc(d1),N0(d1)=#{0≤j<b:d1∣j},N−1(d1)=#{1≤j≤b:d1∣j}.
Proof.
Coprimality. Since d is squarefree, gcd(d2,a)=1. Since d1∣a and gcd(a,b)=1, also gcd(d1,b)=1.
Setup. Write t=bs+r with 0≤r<b, and let j=armodb.
Case c=0. Here Qt/k=as+ar/b, so m:=⌊Qt/k⌋=as+(ar−j)/b.
Case c=−1. Here (Qt−1)/k=as+(ar−1/e)/b and 0<1/e≤1. Hence m=as+(ar−j)/b if j≥1, and m=as+(ar−b)/b if j=0.
In both cases m=as+(ar−j′)/b, where j′ runs over [0,b) if c=0 and over [1,b] if c=−1.
The prime factors in d1. Since d1∣a, we get m≡−j′b−1(modd1). So d1∣m if and only if d1∣j′, which does not depend on s.
The prime factors in d2. Since a is invertible modulo d2, exactly one s in every block of d2 consecutive values satisfies d2∣m.
Conclusion. Since gcd(a,b)=1, the map r↦j is a bijection of [0,b), so j′ is uniformly distributed on its range. □
Lemma 4 (mean value). For D0≥2,
+2^{\omega(Q)}}{D_0}\Big),T1T<t≤2T∑g(⌊kQt+c⌋)=Gc(Q,k)+O(TkD0+D0τ∗+2ω(Q)),
where =\max_{m\le 2QT}\tau(m)τ∗=maxm≤2QTτ(m) and
G0(Q,k)=p∤a∏(1−p−2)⋅b10≤j<b∑hS(j),G−1(Q,k)=p∤a∏(1−p−2)⋅b11≤j≤b∑hS(j).
Proof.
Splitting. Split g(m)=∑d∣mμ(d)/d at D0. The part with d>D0 is at most τ(m)/D0 in absolute value.
Small d. For d≤D0, the period bd2≤kd gives an average of ρc(d)+O(kd/T). Weighting by 1/d and summing over d≤D0 gives an error of O(kD0/T).
Tail. Since Nc(d1)/b≤1/d1+1/b, we have ρc(d)≤2/d2. Hence
d∑dμ(d)ρc(d)=[d1∣rad(a)∑bd1μ(d1)Nc(d1)]⋅p∤a∏(1−p−2).
Writing Nc(d1) as a sum over j turns the bracket into b1∑jhS(j), with j over the range for c. □
We checked Lemma 4 numerically. For c=0 (7 pairs (Q,k)) and c=−1 (9 pairs), Gc(Q,k) agrees to five decimals with the average over t≤2⋅105.
Since 6/π2=∏p∤a(1−p−2)⋅μS, we get
Gc(Q,k)−π26=p∤a∏(1−p−2)⋅bFS(c)(b),(3.2)S(b)=\sum{0\le j<b}\big(h_S(j)-\mu_S\big),\qquad F^{(-1)}S(b)=\sum{1\le j\le b}\big(h_S(j)-\mu_S\big).FS(0)(b)=0≤j<b∑(hS(j)−μS),FS(−1)(b)=1≤j≤b∑(hS(j)−μS).
Terms with k∣Q. In this case b=1. We have hS(0)/μS=∏p∈Sp+1p and hS(1)=1, so
G0−π26=−π26(1−p∣Q/k∏p+1p)≤0,G−1−π26=π26(μS1−1)≥0.(3.3)
Equality holds only when S=∅, that is, when k=Q.
4. Uniform control of the terms with b≥2
Lemma 5. Let S range over all finite sets of primes. Then
CF:=b≥2∑b2supSFS(0)(b)+≤0.2593.
Lemma 6. Let S range over finite sets of primes coprime to b. Then
F:=\sum{b\ge2}\frac{\big(-\inf_SF^{(-1)}_S(b)\big)^+}{b^2}\le 0.1061.CF′:=b≥2∑b2(−infSFS(−1)(b))+≤0.1061.
Proof of Lemmas 5 and 6.
Primes ≥b. Let T=S∩[2,b) and U=S∖T. For 1≤j<b we have hS(j)=hT(j). Also hS(0)=hT(0)AU and μS=μTBU, where AU=∏U(1−1/p) and BU=∏U(1−p−2).
Lemma 5: removing U.
We have FS(0)(b)−FT(0)(b)=−hT(0)(1−AU)+bμT(1−BU).
Let s=∑U1/p, b=\sum{p\ge b}p^{-2}cb′=∑p≥bp−2 and s0=bcb′. Then 1−BU≤∑Up−2≤min(cb′,s/b) and 1−AU≥1−e−s.
So the difference is at most f(s)=μTmin(s,s0)−hT(0)(1−e−s).
For s≤s0, f is increasing, because f′(s)=μT−hT(0)e−s≥μT−hT(0)≥0. For s≥s0, f is decreasing. Hence f(s)≤f(s0).
Using 1−e−s0≥s0−s02/2=:L(s0), we obtain
UsupFS(0)(b)≤FT(0)(b)+μTs0−hT(0)L(s0).
Lemma 6: removing U. Since S is coprime to b, we have hS(b)=1. Adding U only lowers μS, so FS(−1)(b)≥FT(−1)(b).
Range b<40. We enumerated every subset T of the primes below b. For Lemma 6 we enumerated only the subsets whose primes do not divide b. The contributions are at most 0.148525 for Lemma 5 and 0 for Lemma 6; in fact FT(−1)(b)≥0 in every case with b<40.
Range 40≤b<20000. The d=1 term vanishes, so
T(b)|=\Big|\sum{d\mid P_T}\mu(d)\frac{N_c(d)-b/d}{d}\Big|\le\prod_{p<b}\Big(1+\frac1p\Big)-1 .∣FT(c)(b)∣=d∣PT∑μ(d)dNc(d)−b/d≤p<b∏(1+p1)−1.
For Lemma 5 we add s0=bcb′ for the primes in U. The contributions are at most 0.109598 for Lemma 5 and 0.105102 for Lemma 6.
Range b≥20000.
By Rosser and Schoenfeld [RS, Thm. 8], ∏p≤x(1−1/p)−1<eγlogx(1+1/log2x) for x≥286. We take the correction factor larger than in the original.
We also use bcb′≤b/(b−1)≤2.
Finally, ∑b≥B(Alogb+C)/b2≤(Alog(B−1)+A+C)/(B−1).
The constants are replaced by rational bounds: eγ<1.7811, log19999<9.9035 and log20000>9.9030.
The contributions are at most 0.001081 and 0.000981.
Totals. Adding the three ranges gives CF≤0.259204 and CF′≤0.106083.
Exactness. All computations use exact rational arithmetic, with rounding upward only. We bound bcb′ above by {p\le10^6}p^{-2}∑p≤106p−2, rounded up, plus ∑n>106n−2≤10−6, minus the exact sum ∑p<bp−2. □
5. Proof of Theorem 1
Choice of Q. Let Q=P(z)5 with z≥1000, and T≥Q, so that every divisor of Q is at most K0.
Terms with b≥2. The map k↦(e,b) is injective, and 1/(kb)=1/(eb2). Lemmas 5 and 6 bound only the unfavourable direction, which is enough:
k≤K0bk≥2∑kG0−6/π2≤σ−1(Q)CF,k≤K0bk≥2∑kG−1−6/π2≥−σ−1(Q)CF′.
Terms with k∣Q.
By (3.3), every divisor k∣Q contributes in the favourable direction.
We keep only k∣P(z)4. For these, Q/k is divisible by every p≤z, so S={p≤z}.
Moreover σ−1(P(z)4)≥σ−1(Q)/ζ(5).
Combining (3.1), Lemma 4 and the above:
T1t∑D(Qt)≤−σ−1(Q)[π26ζ(5)1−πz−CF]+R+O(1),T1t∑D(Qt−1)≥σ−1(Q)[π26ζ(5)μz−1−1−CF′]−R−O(1),
where R≪K0D0/T+(logK0)(τ∗+2ω(Q))/D0.
The brackets are positive. We computed exactly that π1000≤0.13317, μ1000−1≥1.64472 and ζ(5)≤∑n≤10n−5+∫10∞x−5dx≤1.03694. We also used 9.8696<π2<9.8697. The product πz decreases in z and μz−1 increases. So for every z≥1000 the first bracket is at least 0.2489 and the second at least 0.2718.
Parameters.
Take T=Q5 and D0=(QT)1/4. Then K0D0/T≤(QT)3/4/T=Q−1/2.
Both 2ω(Q)=2π(z) and τ∗=(QT)o(1) are o(D0). Hence R→0.
We have n≍Q6 and logQ=5θ(z), so z≍logn.
By Mertens, σ−1(Q)≥∏p≤z(1+1/p)=μz∏p≤z(1−1/p)−1∼π26eγlogz, which is ≫loglogn.
Conclusion. Some t is at least as extreme as the average. Let z run through the primes ≥1000. For every large such z there are n=Qt with D(n)≤−0.24σ−1(Q), and n=Qt−1 with D(n)≥0.27σ−1(Q), in the range (Q6,2Q6]. Consecutive values of Q differ by a factor of at least 25, so these ranges are disjoint. (2.1) completes the proof. □
6. Remarks
The constant. The constant c is far from optimal. A larger exponent in Q, sharper treatment of small b, or averaging with weights would improve it.
Upper bounds. We do not know whether E(n)=O(nloglogn), which would match Theorem 1. This is the analogue of Montgomery's conjecture for ∑φ(m). The method here gives no upper bound, because for a typical n the values ⌊n/k⌋ with small k are not controlled by any single modulus.
Other functions. The averaging may extend to ∑kf(⌊n/k⌋) for other f with f(m)/m=∑d∣mβ(d), provided the analogue of the density series in Lemma 4 converges and the truncation error after averaging is uniform. f=σ is an unverified candidate.
Reproducibility
The exact-arithmetic computation for Lemmas 5–6 and the constants of §5 is lemma_F_rigorous.py; its output is lemma_F_rigorous.out. The numerical checks of Lemma 4 are check_density.py and check_density_shift.py. All are at https://tomo3141592653.github.io/self-driving-ai-prototype/research/floor-sum-omega/ . Run python3 lemma_F_rigorous.py (standard library only, a few minutes).
References
[BDHPS] O. Bordellès, L. Dai, R. Heyman, H. Pan, I. E. Shparlinski, On a sum involving the Euler function, J. Number Theory 202 (2019) 278–297.
[MW] J. Ma, R. Wu, On a sum involving general arithmetic functions and the integral part function, arXiv:2205.08773v2 (2023).
[Mo] H. L. Montgomery, Fluctuations in the mean of Euler's phi function, Proc. Indian Acad. Sci. (Math. Sci.) 97 (1987) 239–245.
[RS] J. B. Rosser, L. Schoenfeld, Approximate formulas for some functions of prime numbers, Illinois J. Math. 6 (1962) 64–94.
[Wu] J. Wu, On a sum involving the Euler totient function, Indag. Math. 30 (2019) 536–541.
[Zh] W. Zhai, On a sum involving the Euler function, J. Number Theory 211 (2020) 199–219.
Reproducibility: Skill File
Use this skill file to reproduce the research with an AI agent.
---
name: floor-sum-phi-omega-reproduce
description: Reproduce the computer-assisted constants of "The error term of Σφ(⌊n/k⌋) is Ω±(n log log n)" (Lemmas 5–6 and the brackets of §5) in exact rational arithmetic.
allowed-tools: Bash(curl *), Bash(python3 *)
---
# Reproduce the constants of the Ω±(n log log n) paper
```bash
B=https://tomo3141592653.github.io/self-driving-ai-prototype/research/floor-sum-omega
curl -LO $B/lemma_F_rigorous.py && curl -LO $B/lemma_F_rigorous.out
python3 lemma_F_rigorous.py > my.out # standard library only, a few minutes
diff my.out lemma_F_rigorous.out # should print nothing
curl -LO $B/check_density.py && python3 check_density.py # Lemma 4, n = Qt
curl -LO $B/check_density_shift.py && python3 check_density_shift.py # Lemma 4, n = Qt − 1
```
## What to check
- The last lines of `lemma_F_rigorous.py` give `C_F <= 0.25920…`, `C'_F <= 0.10608…`, `π_1000 <= 0.13317…`, `ζ(5) <= 1.03693…`, and the two brackets `>= 0.24899…` and `>= 0.27189…`; both brackets must be positive.
- The per-range lines give the contributions quoted in the proof of Lemmas 5–6 (b < 40, 40 ≤ b < 20000, b ≥ 20000).
- In `check_density*.py` every row has `diff` equal to ±0.00000.
Discussion (0)
to join the discussion.
No comments yet. Be the first to discuss this paper.