I am wondering if it is possible to get a useful exact formula, or at least some useful asymptotics, for the partial sums of the Liouville function (OEIS sequence A002819) $$L(n)=\sum_{k=1}^n \lambda(k),$$ by exploiting the identity $$\sum_{k=1}^n \lambda(k)\Big\lfloor \frac{n}{k}\Big\rfloor = \lfloor \sqrt{n}\rfloor.$$

The behavior of $L(n)$ is strongly related to the Riemann hypothesis; see here for a great related MO question asked 11 years ago. The above formula, in theory, allows you to compute $L(n)$ exactly as a linear combination

$$L(n)=a_1\cdot\lfloor\sqrt{1}\rfloor +\cdots +a_n\cdot\lfloor\sqrt{n}\rfloor$$

with integer coefficients, by inverting a somewhat complicated $n \times n$ triangular matrix. Not sure if anyone tried to do it. I tried to give it a shot, and something more interesting than I would have expected, came out of it. My question is whether it is possible to go beyond what I discovered so far, maybe like getting a more complete solution, or more importantly, see whether some asymptotics can be derived, which could potentially bring some insights about RH.

If anything, my solution leads to a fast, exact computation of $L(n)$ for large $n$, since the immense majority of the coefficients in the linear combination mentioned above, are zero.

**What I found and where I am stuck**

The main result is this:

$$L(n)=A(n)+B(n), \mbox{ } \mbox{ } \mbox{with}\\ A(n)=\sum_{k=1}^{u_n} \mu(k)\Big\lfloor\sqrt{\frac{n}{k}}\Big\rfloor, \mbox{ } \mbox{ } B(n)=\sum_{1}^{v_n} a_k \Big\lfloor\sqrt{k}\Big\rfloor.$$

Here $\mu(\cdot)$ is the Moebius function and $v_n=\lfloor \sqrt{n/u_n}\rfloor - 1$. It's not obvious to me how large $u_n$ can be, that is, how far can I extend $A(n)$. If you can determine $u_n$, that is enough for your answer to be accepted. Likewise, I haven't managed to find strong patterns in the coefficients $a_k$ in $B(n)$. If you have a simple explicit formula for those $a_k$'s, that would also be an accepted answer. In any case, $a_k$ can be computed explicitly, be it one of the numerous zeros, one of the Moebius coefficients in $A(n)$ or one of the unknown coefficients in $B(n)$.

You can compute the $a_k$'s using the backward following recurrence, with initial condition $a_n=1$, and the iteration

$$a_{n-k}=1-\sum_{j=0}^{k-1} \Big\lfloor\frac{n-j}{n-k}\Big\rfloor a_{n-j}$$

successively for $k=1, 2, \cdots,n-1$. Note that the summation formula $L(n)=A(n)+B(n)$ seems to have $o(n)$ terms. For instance, if $n=22500$ we have 95 non-zero terms in $A(n)$, and 210 non-zero terms total.

**Note**

The sequence $(u_n)$ is increasing. It would be interesting to see its asymptotic behavior. I am also interested in an asymptotic formula for total number of non-zero terms in my formula. Finally, an answer involving the Mertens function (instead of Liouville) is also acceptable.

**Approximations and asymptotics**

The plot below corresponds to $n=22501$. The Y-value on the far left corresponds to the first non-zero term $a_n \lfloor \sqrt{n}\rfloor$. Of course, $a_n=\mu(1)=1$. The more we move to the right, the more non-zero terms are added, until at the far right where all the 210 non-zero terms have been added and the Y-value represents $L(n)$. Terms are being added in decreasing order, starting with $\lfloor\sqrt{n}\rfloor$ and ending with $\lfloor\sqrt{1}\rfloor$.

The lower and upper curves corresponds to $95\%$ empirical percentiles. This band gives a very good idea about possible range of values for $L(n)$, even after adding only the top 15 non-zero terms. Also, because $\mu(1)=1$, $\mu(2)=\mu(3)=\mu(5)=-1$ and $\mu(4)=0$, we start with a large positive value, but quickly drop to largely negative values and have a hard time getting back into positive territory. This explains why $L(n)$ is negative for about the first billion values of $n$.

The plot below shows the values of $a_k \lfloor \sqrt{k}\rfloor$ in decreasing order of the square root, only for those 210 $a_k$'s that are non-zero. The smooth portion on the left corresponds to terms in $A(n)$, with $a_k\in\{-1,+1\}$. The right side corresponds to terms in $B(n)$, with a more chaotic behavior. It would be interesting to know if $A(n)$ dwarfs $B(n)$ or not, my guess is that they have the same order of magnitude and are balancing out each other.

**Update on 5/21/2021**

Below are two new developments that may be of interest to the reader.

**Update 1**

The sum of the first $10^2$ terms of $A(n)$, which is always the same if $n$ is large enough, is very negative and approximately equal to $-\sqrt{n}$, regardless of $n$. This remains true even for the sum of the first $10^3$, $10^4$ or $10^5$ terms, as illustrated in the plot below. In the plot below, $n=10^{60}$, the $Y$-axis represents the sum of the first $k$ terms of $A(n)$ up to $k=10^5$, and the $X$-axis represents $k$.

This means that it is very hard for $L(n)$ to be positive, and it is typically more often negative than positive. However $L(n)$ changes sign infinitely many times. For $L(n)$ to be positive, you need to have $n$ very large and hope that there are enough terms in $A(n)$ to make $A(n)$ positive (probably unlikely to happen) or that $B(n)$ is very high, approximately equal to $+\sqrt{n}$ to cancel out the highly negative $A(n)$.

**Update 2**

About replacing the integer part function in the backward recurrence formula that defines $a_{n-k}$, by a smooth approximation (e.g. based on Fourier series expansions). I tested the following approximation:

$$a_{n-k}=1-\sum_{j=0}^{k-1} \Big(\frac{n-j}{n-k} - \frac{1}{2}\Big) a_{n-j},$$

($k=1,2,\cdots,n-1$) still with $a_n=1$. The result is that now, all $a_k$'s are non-zero. The new $a_k$'s are totally different from the old ones, but the new $L(n)$ is not much different, its magnitude seemingly unchanged. To avoid confusion, the new $L(n)$ obtained with the approximation discussed here is denoted as $L^*(n)$, and we can decompose it as follows:

$$L^*(n)=C(n) + D(n), \mbox{ } \mbox{ } \mbox{ } \mbox{ with } \\ C(n)=\sum_{k=0}^{w_n} a_{n-k}\lfloor\sqrt{n-k}\rfloor, \mbox{ } \mbox{ } \mbox{ } D(n) =\sum_{k=w_n +1}^{n-1} a_{n-k}\lfloor\sqrt{n-k}\rfloor. $$

The nice result is that $w_n$ is extremely small compared to $n$, and all the $a_k$'s in $D(n)$ are almost identical, so you get the following excellent approximation for $D(n)$:

$$D(n) \sim a_{w_n +1} \sum_{k=w_n +1}^{n-1} \lfloor\sqrt{n-k}\rfloor \sim \frac{2 a_{w_n +1}}{3} \cdot n^{3/2}.$$

Also $C(n)\sim 2\sqrt{n}$ and $a_{w_n +1}\sim -4/n$. Thus $L^*(n) \sim -\frac{2}{3}\sqrt{n}$. For instance, if $n=22500$, you can choose $w_n=20$. It results in $C(n)=298.55$ and $a_{w_n +1}=-0.000177$. The approximate $D(n)$ using the above formula is $398.25$. Thus $L^*(n)\approx 298.55-398.25 \approx -99.7$. The true value is $L^*(n)=-99.013\dots$ and the true value of $L(n)$ is $L(n)=-86$. The big question is how well $L^*(n)$ approximates $L(n)$. It is my hope that there are two strictly positive constants $c_1,c_2$ such that $c_1 < L^*(n)/L(n) < c_2$ is bounded. If that is the case, then you can use either $L$ or $L^*$ to determine the abscissa of convergence of

$$\sum_{k=1}^\infty \frac{\lambda(k)}{k^s}=\frac{\zeta(2s)}{\zeta(s)}.$$

The abscissa in question is

$$\sigma_c=\lim\sup_{n\rightarrow\infty}\frac{\log|L(n)|}{\log n} \stackrel{?}{=}\lim\sup_{n\rightarrow\infty}\frac{\log|L^*(n)|}{\log n}=\frac{1}{2}.$$

If $\sigma_c=\frac{1}{2}$, it would prove RH. Using more terms in the Fourier expansion of $\lfloor\cdot\rfloor$ does not help.

**Source code**

Here is raw source code in Perl, just in case there are typos left in my text. The source code does the correct computations, both for Louiville, Mertens, and other related functions.=.

```
### Approx [x]: x-0.5
### Sum[LiouvilleLambda[k],{k,1,10000}]=-94 | My Approx: -66.864752863936
### Sum[LiouvilleLambda[k],{k,1,20000}]=-54 | My Approx: -95.8592077112619
### Sum[LiouvilleLambda[k],{k,1,40000}]=-180 | My approx: -129.653234371957
### Sum[LiouvilleLambda[k],{k,1,60000}]=-268 | My approx: -156.18294813206
### Sum[LiouvilleLambda[k],{k,1,80000}]=-136 | My approx: -189.98311248939
### Sum[LiouvilleLambda[k],{k,1,100000}]=-288 | My approx: -211.563785745252
### Sum[Moebius[k]*int(2000/k),{k,1,2000}]
$pi=3.14159265358979323846;
$n=600;
$M=40;
$aa=1.5; # 0.5 Liouville | 0 Moebius
$bb=1.5; # 1 Liouville | 1 Moebius
$a[$n]=1;
$divisor=1;
$term=int($n**$aa); #
$L=$term;
open(OUT,">liou2.txt");
print OUT "$n\t$a[$n]\t$divisor\t$term\t$L\n";
for ($k=1; $k<$n; $k++) { ### $k<$n;
$sum=0;
for($j=0; $j<$k; $j++) {
$x=($n-$j)/($n-$k);
$x=$x**$bb; #
$c=int($x); ## exact solution L(n)
#$c=$x-0.5; ## approximation L*(n)
### +(1/$pi)*( sin(2*$pi*$x)/1 ); ### + sin(4*$pi*$x)/2 + sin(6*$pi*$x)/3 )+ sin(8*$pi*$x)/4 + sin(10*$pi*$x)/5 + sin(12*$pi*$x)/6 );
$b=$a[$n-$j];
$sum+=$b*$c;
}
$a[$n-$k]=1-$sum;
$m=$n-$k;
$divisor=int($n/$m);
$term=$a[$m]*int($m**$aa); #
$L+=$term;
if ($k==$M) { $C=$L; $aw=$a[$n-$k]}
if ($a[$m] != 0) { print OUT "$m\t$a[$m]\t$divisor\t$term\t$L\n"; }
}
close(OUT);
$D=(2/3)*$aw*$n**(3/2);
$Lapprox=$C+$D;
print "\nL($n) = $L\nLapprox($n) = $Lapprox\n";
```

4more comments