Liouville Function Calculator
Input
- Factor 30 into primes: 30 = 2 x 3 x 5. The Liouville function counts the prime factors with multiplicity: here Omega(30) = 3.
- With Omega(30) = 3 (odd), lambda(30) = (-1)^3 = -1.
- The number of distinct prime factors is 3, but the sign of lambda depends only on the total count with multiplicity.
- Adding lambda(k) for every k from 1 to 30 gives the summatory Liouville function L(30) = -4, the running total once studied in the Polya conjecture.
The Liouville function calculator computes lambda(n) = (-1)^Omega(n), where Omega(n) counts the prime factors of n with multiplicity. Enter a whole number and the tool returns its value: +1 or -1. For example, 30 = 2 x 3 x 5 has Omega = 3, so lambda(30) = -1. And 100 = 2^2 x 5^2 has Omega = 4, so lambda(100) = +1, even though only 2 distinct primes are involved. The page also reports the summatory function L(n), which adds lambda(k) up to n: L(30) = -4 and L(100) = -2.
The method is the accepted standard for this kind of calculation because it follows the definition directly: factor the number into primes, count each prime as many times as it appears, and apply the sign. Nothing is estimated or rounded, so the result is exact. The Liouville function also carries real mathematical weight. Polya's conjecture, that L(n) never turns positive beyond the start, held for enormous ranges before a counterexample was found far out. This page shows the formula, step-by-step workings, worked examples and sources, so you can check every result yourself.
Worked examples
Lambda of 30
(30)
| Liouville function lambda(n) | -1 |
| Prime factors with multiplicity, Omega(n) | 3 |
| Distinct prime factors | 3 |
| Summatory value L(n) | -4 |
Lambda of 12
(12)
| Liouville function lambda(n) | -1 |
| Prime factors with multiplicity, Omega(n) | 3 |
| Distinct prime factors | 2 |
| Summatory value L(n) | -2 |
Lambda of 100
(100)
| Liouville function lambda(n) | 1 |
| Prime factors with multiplicity, Omega(n) | 4 |
| Distinct prime factors | 2 |
| Summatory value L(n) | -2 |
A sign from the prime factorization
The Liouville function turns a factorization into a single sign, and the exponent in its definition is Omega(n), the count of prime factors taken with multiplicity. Multiplicity means you count every copy, so 2 x 2 x 5 contributes three factors, not two. The function is lambda(n) = (-1)^Omega(n): an even Omega gives +1, an odd Omega gives -1. A liouville function calculator applies this rule directly, but seeing two worked examples makes the counting choices concrete.
Take 30 = 2 x 3 x 5. Three distinct primes appear, each exactly once, so Omega(30) = 3. Three is odd, so lambda(30) = -1. Now take 100 = 2^2 x 5^2. Only 2 distinct primes are involved — 2 and 5 — but multiplicity changes the total: two copies of 2 plus two copies of 5 give Omega(100) = 4. Four is even, so lambda(100) = +1. The contrast is the whole point. If you counted distinct primes only, 30 and 100 would both score 3, and both would come out -1. With multiplicity, 100 flips to +1 because its repeated factors add one more to the count.
The summatory function L(n) adds lambda(k) from 1 up to n, so individual signs accumulate into a running total. For these two values, L(30) = -4 and L(100) = -2. Notice that L is negative at both points even though lambda(100) itself is +1: the running total depends on every term below n, not just the last one. That is why a single positive sign does not by itself push the sum above zero.
This accumulation is where the Liouville function gets its reputation. Polya's conjecture held that L(n) never turns positive beyond the start — that the negative terms always keep the running total at or below zero. The conjecture held for enormous ranges before a counterexample was found far out. The lesson for anyone using the calculator is that small inputs can look completely regular while the long-run behavior is still delicate; the sign of lambda(n) is easy to compute exactly, but the sum of those signs is a subtler object.
When you check a value, the reliable path is to factor n completely, count every prime copy, and apply the parity rule. The calculator does that arithmetic for you, but the two examples above show what it is counting — and why 100, despite having fewer distinct primes than 30, ends up with the positive sign.
- 30 = 2 x 3 x 5: Omega(30) = 3, odd, so lambda(30) = -1.
- 100 = 2^2 x 5^2: Omega(100) = 4, even, so lambda(100) = +1, with only 2 distinct primes involved.
- Running totals: L(30) = -4 and L(100) = -2.
Computing lambda step by step
To compute the Liouville function for a number, you do three things in order: factor the number into primes, count those prime factors with multiplicity, and attach a sign based on that count. The definition is lambda(n) = (-1)^Omega(n), where Omega(n) counts the prime factors of n with multiplicity. Multiplicity means you count repeated factors each time they appear: in 2^2, the factor 2 counts twice, not once. When you use a liouville function calculator, this is the exact procedure happening behind the result, so it helps to see it worked out by hand first.
Start with 30. Its factorization is 30 = 2 x 3 x 5, so the prime factors are 2, 3 and 5, each appearing once. That gives Omega(30) = 3. Because the exponent in the definition is odd, the sign is negative: lambda(30) = -1. Nothing is repeated here, so the count is simply the number of distinct primes, but that is a coincidence of this example rather than a rule.
Now take 100. Its factorization is 100 = 2^2 x 5^2. Only 2 distinct primes are involved, yet the multiplicity count is Omega(100) = 4, because each prime appears twice. With an even exponent, the sign is positive: lambda(100) = +1. Comparing the two examples shows why multiplicity matters: counting distinct primes would give 2 for 100 and also point to a positive sign, but for other numbers the two counts can disagree, and the definition follows the multiplicity count every time.
The step-by-step method therefore reduces to a short checklist. Factor completely into primes, add up the exponents in that factorization to get Omega, then write (-1)^Omega as +1 for an even total and -1 for an odd total. The arithmetic itself is trivial once the factorization is in hand; the only real work is making sure no repeated factor is skipped.
- Factor the number completely into primes, keeping repeated factors visible.
- Add the exponents to get Omega(n), the count with multiplicity.
- Even Omega gives lambda(n) = +1; odd Omega gives lambda(n) = -1.
- Check: 30 = 2 x 3 x 5 gives Omega = 3 and lambda(30) = -1.
- Check: 100 = 2^2 x 5^2 gives Omega = 4 and lambda(100) = +1.
| n | Prime factorization | Omega(n) | lambda(n) |
|---|---|---|---|
| 30 | 2 x 3 x 5 | 3 | -1 |
| 100 | 2^2 x 5^2 | 4 | +1 |
The summatory function L(n)
The summatory function L(n) is the running total of the Liouville function: it adds lambda(k) for every integer k from 1 up to n. Where lambda(n) answers a single question about one number, L(n) answers a cumulative one — after counting all the values up to n, has the positive side or the negative side won so far? Because each lambda(k) is either +1 or -1, L(n) is an ordinary integer that steps up by one or down by one as you move from k to k+1. A liouville function calculator typically shows both layers side by side: the individual value of lambda for each number, and the growing total L(n) beneath it.
Small examples make the running total concrete. For n = 12, the sum of lambda(k) from 1 through 12 is L(12) = -2. For n = 30, the total is L(30) = -4. For n = 100, it is L(100) = -2. Notice that L(30) is not simply L(12) plus something obvious — the total wanders as each new term pushes it up or down, and the intermediate values can be higher or lower than the endpoints. That wandering is the whole point of studying L(n): the individual signs are easy to describe, but their cumulative balance is not.
The sign of the total carries a plain meaning. If L(n) is positive, then among the integers from 1 to n there have been more k with an even number of prime factors (counting multiplicity) than with an odd number, since lambda(k) = +1 exactly in the even case. If L(n) is negative, the odd case has been more common so far. The magnitude tells you the size of the lead. So L(12) = -2 means the odd side leads by two at that point, L(30) = -4 means the odd side leads by four, and L(100) = -2 means the lead has shrunk back to two by the hundredth term. A total of zero would mean the two sides are exactly tied.
Individual values fit this picture. Since 30 = 2 x 3 x 5 has Omega = 3, lambda(30) = -1, a term that pulls the running total down. Since 100 = 2^2 x 5^2 has Omega = 4, lambda(100) = +1 — only 2 distinct primes are involved — and that term pushes the total up. Multiplicity matters: repeated factors still count toward Omega, which is why 100 lands on the positive side.
The long-run behavior of L(n) has a famous history. Polya's conjecture held that L(n) never turns positive beyond the start, and it was verified for enormous ranges before a counterexample was found far out. That result is a caution: patterns that look stable across a vast stretch of the number line can still break, which is why computing L(n) directly over a range remains useful.
Polya's conjecture and its fall
The Liouville function gives every positive integer a sign: lambda(n) = (-1)^Omega(n), where Omega(n) counts the prime factors of n with multiplicity. Because the sign flips with each prime factor, numbers with an odd count of factors are negative and numbers with an even count are positive. The number 30 = 2 x 3 x 5 has Omega = 3, so lambda(30) = -1. The number 100 = 2^2 x 5^2 has Omega = 4, so lambda(100) = +1 — and note that only 2 distinct primes are involved, but multiplicity still pushes the count to 4.
Out of these signs comes the summatory function L(n), which adds lambda(k) from 1 up to n. At n = 30, L(30) = -4; at n = 100, L(100) = -2. Running these sums by hand is tedious, which is why a liouville function calculator is handy for watching the running total move up and down as each new sign is added.
Looking at early values of L(n), a tempting pattern appears. The sum starts at 1 for n = 1, then drops, and for a long stretch it seems to stay at or below zero, dipping negative and only occasionally returning toward the starting line. This observation became Polya's conjecture: the claim that L(n) never turns positive beyond the start. It is an appealing guess because the signs of lambda look roughly balanced, and a balanced stream of +1 and -1 values would be expected to hover near zero rather than climb steadily above it.
What makes the story striking is how long the conjecture survived. It held for enormous ranges of n — far beyond anything a person could check by hand, and far enough that it looked like a settled fact rather than a guess. Generations of computation kept finding L(n) at or below zero, reinforcing the impression that the pattern was real.
Then it failed. A counterexample was eventually found far out, at a value of n so large that no amount of early tabulation could have revealed it. Beyond that point, L(n) does turn positive. The lesson is a familiar one in number theory: a pattern that holds across a vast computational range is still not a proof. Polya's conjecture is now known to be false, and the Liouville function remains a favorite example of how plausible-looking regularities can break down only after an immense stretch of numbers.
FAQs
What is the Liouville function?
The Liouville function is written lambda(n) = (-1)^Omega(n). It equals +1 when n has an even total number of prime factors and -1 when that total is odd. The count includes factors with multiplicity, so a repeated prime is counted each time it appears. It is defined for positive integers n.
What is lambda(30)?
lambda(30) = -1. The reason is that 30 = 2 x 3 x 5, which has 3 prime factors. Since 3 is odd, the function returns -1. The three factors here are all distinct, so the multiplicity count is also 3, and the exponent in (-1)^Omega(30) is odd.
What is the difference between Omega and the distinct count?
Omega counts prime factors with multiplicity, while the distinct count counts each different prime only once. For example, 100 = 2^2 x 5^2 has Omega = 4 but only 2 distinct prime factors. The Liouville function uses Omega, so repeated primes matter: they change the parity of the exponent.
What is lambda(100)?
lambda(100) = +1. Writing 100 = 2^2 x 5^2 gives 4 prime factors with multiplicity: two 2s and two 5s. Because 4 is even, the exponent in (-1)^Omega(100) is even, so the result is +1. Counting distinct primes instead would give 2, which is also even here, but the multiplicity count is what the function uses.
What is the summatory Liouville function?
The summatory Liouville function L(n) is the sum of lambda(k) for k from 1 to n. For example, L(30) = -4 and L(100) = -2. It accumulates the +1 and -1 values of the Liouville function over the integers up to n, so its value reflects how the even and odd factor counts balance out.
Where does the Liouville function appear?
The Liouville function appears in analytic number theory. Its summatory behavior connects to the distribution of primes and to the Riemann hypothesis. Because lambda(n) tracks the parity of the total prime factor count, studying how its partial sums grow gives information about prime numbers and related questions in that field.