Liouville Function Calculator

Find the Liouville sign of an integer from its prime exponents, with the total factor count shown.

Math and PercentUpdated 2026-11-182 min read
Liouville Function Calculator
A whole number from 1 to 1,000,000,000,000.
Liouville value lambda(n)
...
Prime factors with multiplicity...
Prime factorization...

What it does

The Liouville function assigns a sign to every positive integer. It is named after Joseph Liouville, a nineteenth century mathematician who used it in work on continued fractions and number theory. The definition is short: write the integer as a product of primes, count those primes with multiplicity, and take minus one raised to that count.

Multiplicity is the key detail. The number 12 is two squared times three, so its prime factors are 2, 2 and 3, giving a total of three. An odd total makes the value minus one. The number 4 has factors 2 and 2, a total of two, so its value is plus one even though only one distinct prime appears.

The function is completely multiplicative, meaning that the value of a product is the product of the values. That property makes it useful in identities involving Dirichlet series, and it connects the function to the Mobius function through sums over divisors.

This page factors the input, adds the exponents and reports the resulting sign together with the count and the factorization. Seeing the factorization beside the sign makes it easy to check the parity by hand.

Inputs stop at one trillion so the browser factorization stays quick. The result is a sign with no unit, and the tool prints it as the character plus one or minus one rather than a decimal approximation.

How to use

  1. Enter a whole number n from 1 upward.
  2. Read the Liouville sign in the main result box.
  3. Check the prime factor count beside it.
  4. Use the factorization to confirm the parity yourself.
  5. The default n = 12 reproduces the worked example.
  6. Try n = 4 to see how a repeated prime changes the count.

Formula

lambda(n) = (-1)^Omega(n), where Omega(n) is the number of prime factors counted with multiplicity
n
The positive integer being classified.
Omega(n)
The sum of exponents in the prime factorization of n.
lambda(n)
The sign plus one or minus one assigned to n.

For n = 1 the factorization is empty, so Omega(1) = 0 and lambda(1) = 1. For a prime power p^a the count is a, so the sign alternates as the exponent rises. Because the count includes repeats, lambda(4) is plus one while lambda(2) is minus one.

Worked example

Example: lambda(12)

The page opens with n = 12.

  1. Factor 12 into 2^2 x 3.
  2. Read the exponents: 2 for the prime 2 and 1 for the prime 3.
  3. Add them: Omega(12) = 2 + 1 = 3.
  4. Raise minus one to that power: (-1)^3 = -1.
  5. The tool reports -1, prime factor count 3, and factorization 2^2 x 3.
  6. Compare with 4, where the count is 2 and the sign is plus one.

Reference table

Liouville values for small integers
nFactorizationOmega(n)lambda(n)
1none01
221-1
42^221
82^33-1
122^2 x 33-1
302 x 3 x 53-1

Limits

  • Only positive integers have a Liouville value here.
  • Inputs above one trillion are rejected to keep factoring fast.
  • The tool returns the sign, not the summatory Liouville function.
  • Prime exponents are counted, so repeats matter.

Common mistakes

  • Counting distinct primes only, which gives the wrong parity for numbers with squares.
  • Assuming the function can return zero.
  • Forgetting that lambda(1) is plus one.
  • Confusing this sign with the Mobius value, which can also be zero.
  • Using a decimal approximation of minus one instead of the exact sign.

Try it yourself

Quick checks. Answers sit tucked under each question.

What is lambda(4)?

4 = 2^2, so Omega(4) = 2 and lambda(4) = +1.

What is lambda(30)?

30 = 2 x 3 x 5, so Omega(30) = 3 and lambda(30) = -1.

What is lambda(1)?

There are no prime factors, so Omega(1) = 0 and lambda(1) = +1.

Questions

Who was Liouville?

Joseph Liouville was a French mathematician who worked on number theory, analysis and continued fractions in the nineteenth century.

How does this differ from the Mobius function?

Mobius counts distinct primes and returns zero when a square divides, while Liouville counts with multiplicity and never returns zero.

Is the function multiplicative?

Yes, it is completely multiplicative, so lambda(ab) equals lambda(a) times lambda(b) for all positive integers.

Why does the sign alternate with exponents?

Each extra prime factor flips minus one raised to the count, so raising an exponent by one reverses the sign.

What is Omega(1)?

It is zero, because the number 1 has no prime factors at all.

What input limit does this page use?

Whole numbers from 1 through 1,000,000,000,000, with a readable error beyond that.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.