# Liouville's function and triangular numbers

Jon Maiga, 2018-11-23

This article describes a small observation I made between consecutive terms of Liouville’s function and the triangular numbers, namely

$\lambda(n)=\lambda(n+1) \iff \lambda(\frac{n(n+1)}{2})=-1$

## Liouville's function

The Liouville function, $\lambda(n)$, denotes the parity of the number of prime factors of n,

$\lambda(n)=(-1)^{\Omega(n)}$

where Omega, $\Omega(n)$ is the number of prime divisors of n.

$\lambda(n) = \begin{cases} 1, & \text{if \Omega(n) is even} \\ -1, & \text{if \Omega(n) is odd} \end{cases}$

So for example

$\lambda(10)=(-1)^{\Omega(5\cdot2)}=(-1)^2=1$

$\lambda(12)=(-1)^{\Omega(3\cdot2\cdot2)}=(-1)^3=-1$

In oeis.org this sequence is

A008836 Liouville’s function lambda(n) = (-1)^k, where k is number of primes dividing n

Where the first few terms of $\lambda(n)$ are

1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1,…

## The triangular numbers

To get the triangular numbers, let use $\Delta(n)$, you just keep adding $n$ to the previous term, starting at 0: $0, 0+1=1, 1+2=3, 3+3=6, 6+4=10, ....$

If you want to get the $nth$ triangular number directly you can use

$\Delta(n)=\frac{n(n+1)}{2}$

A000217 Triangular numbers: a(n) = binomial(n+1,2) = n(n+1)/2 = 0 + 1 + 2 + … + n.

The first few triangular numbers are
0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153,…

## The relationship

As usual when playing with sequencedb.net I noticed a new formula for

A221280 Numbers n such that lambda(n) = lambda(n+1).

2, 7, 9, 11, 12, 14, 15, 17, 18, 19, 21, 24, 25, 27, 28, 29,…

The procedurally found formula managed to generate A221280 by via the triangular numbers which caught my attention.

$\lambda(n)=\lambda(n+1) \iff \lambda(\frac{n(n+1)}{2})=-1$

I verified this for 10^5 terms and felt pretty confident that this relationship holds for all n and generates the full sequence and not just a subset.

## The proof

The proof is simple, what we are saying is that

$\lambda(n)=\lambda(n+1) \iff \lambda(\frac{n(n+1)}{2})=-1$

this means $(-1)^{\Omega(\frac{n(n+1)}{2})}=-1$

so $\Omega(\frac{n(n+1)}{2})$ has to be odd, hence, if we drop the division by 2, $\Omega(n(n+1))$ has to be even.

Now we can rewrite $\Omega(n(n+1))=\Omega(n)+\Omega(n+1)$ since $\Omega$ counts the factors and the inner multiplication adds them (e.g. $\Omega(3*4)=\Omega(3)+\Omega(2)+\Omega(2)=3$).

Because $\Omega(n(n+1))$ has to be even then both $\Omega(n)$ and $\Omega(n+1)$ require to be of the same parity (even=odd+odd or even+even).

Finally we put back the division of two to get to the triangular numbers again, and changing by a factor requires $Ω(\frac{n(n+1)}{2})$ to be odd.

Clearly the complement work as well, $\lambda(n)\ne\lambda(n+1) \implies \lambda(\frac{n(n+1)}{2})=1$.

After writing it down it seems very obvious.

## Final thoughts

Is it’s possible to extend this method to $\lambda(n)=\lambda(n+1)=\lambda(n+2)$ or generally to any extent?

Written with StackEdit.