Liouville Lambda Function
Return λ(n)=(−1)^Ω(n), counting prime factors with multiplicity and using λ(1)=1; trial division is limited to n≤10¹².
Description
Liouville’s lambda records the parity of the total prime-factor multiplicity.
Liouville’s lambda records the parity of the total prime-factor multiplicity. An even number of factors gives one and an odd number gives minus one.1
The tool returns value. The indexing and output conventions below determine how to read these values.
When to use Liouville Lambda Function
Use this for the following task: Return λ(n)=(−1)^Ω(n), counting prime factors with multiplicity and using λ(1)=1; trial division is limited to n≤10¹². Use the input and output conventions below to reproduce the intended mathematical quantity.
How to use Liouville Lambda Function and understand its results
- Choose the required indexes, integers or sequence entries. Preserve decimal-string encodings where the field table specifies strings.
- Enter n according to the field table, then run the tool.
- Read value. Use the stated units, indexing and interpretation of the numerical result.
- Keep exact decimal strings for subsequent integer arithmetic; distinguish them from any explicitly approximate numeric result.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| n | Positive integer (trial-division resource limit 10^12) | integer; minimum 1; maximum 1000000000000 | Required |
Factor positive n, sum every exponent and choose the sign from the sum’s parity. One has zero total multiplicity and returns one.
λ(n)=(−1)^Ω(n) The symbols and boundary conditions refer to the supplied fields and the implementation described above.
| Output field | Meaning | Value type |
|---|---|---|
| value | Liouville sign | integer |
{
"input": {
"n": 72
},
"output": {
"value": -1
}
} Limitations and assumptions
The input is capped at 10¹². Unlike the Möbius function, repeated prime factors do not force this value to zero.
Use the declared integer bounds and string formats. Large exact outputs remain decimal strings; numerical approximations use ordinary floating-point arithmetic. A rejected input is different from a valid zero count or false membership flag.
Alternative or Complementary methods
Choose Prime Factor Count with Multiplicity when you need its operation: Return Ω(n), the total number of prime factors counting their exponents, with Ω(1)=0 and trial division limited to n≤10¹². Choose Mertens Function for the complementary operation: Return M(n)=Σ(k≤n)μ(k) exactly by sieving distinct prime factors and square factors, with M(0)=0 and n capped at 1,000,000.
Background reference: Digital Library of Mathematical Functions, §27.2.
References
-
Digital Library of Mathematical Functions, §27.2 — National Institute of Standards and Technology
Similar or alternative tools
- Prime Factor Count with Multiplicity
Return Ω(n), the total number of prime factors counting their exponents, with Ω(1)=0 and trial division limited to n≤10¹².
- Mertens Function
Return M(n)=Σ(k≤n)μ(k) exactly by sieving distinct prime factors and square factors, with M(0)=0 and n capped at 1,000,000.