Mangoldt Function Calculator
Prime powers
- The von Mangoldt function Lambda(n) equals ln p when n is a prime power p^k, and 0 for every other n.
- Factor 8 = 2^3 and ask whether a single prime accounts for the whole number.
- It does - 8 is a power of 2 - so Lambda(8) = ln 2 = 0.6931.
- The divisor identity confirms the value: summing Lambda(d) over the divisors of 8 always returns ln(8) = 2.0794.
The von Mangoldt function is analytic number theory's prime detector. It is defined by a deliberate act of ignoring almost everything: Lambda(n) equals ln p if n is a power of a single prime p, and 0 for every other n. Out of that stark definition come the Chebyshev psi function, the explicit formulae for pi(x), and the cleanest bridge between the primes and the zeros of the zeta function.
This calculator evaluates Lambda(n) from the factorization, states whether n is a prime power and of which prime, and then cross-checks the value against the divisor identity: summing Lambda(d) over all divisors d of n must return exactly ln n. The three anchor cases cover the behaviour: Lambda(8) = ln 2 = 0.6931 because 8 = 2^3; Lambda(12) = 0 because 12 = 2^2 x 3 mixes two primes; Lambda(27) = ln 3 = 1.0986 because 27 = 3^3.
The identity check is not decoration. It is the property that makes Lambda the right weighting: summed over divisors it reconstructs the logarithm, and summed over initial segments it gives psi(x) - which is why the Chebyshev page and this one are siblings.
Worked examples
Lambda(8)
(8)
| Lambda(8), the von Mangoldt function | 0.6931 |
| prime factorization of n | 2^3 |
| is n a prime power p^k? | Yes - 2^3 is a power of the single prime 2 |
| sum of Lambda(d) over the divisors d of n | 2.0794 = ln(8) |
Lambda(12)
(12)
| Lambda(12), the von Mangoldt function | 0.0000 |
| prime factorization of n | 2^2 x 3 |
| is n a prime power p^k? | No - n is not a prime power |
| sum of Lambda(d) over the divisors d of n | 2.4849 = ln(12) |
Lambda(27)
(27)
| Lambda(27), the von Mangoldt function | 1.0986 |
| prime factorization of n | 3^3 |
| is n a prime power p^k? | Yes - 3^3 is a power of the single prime 3 |
| sum of Lambda(d) over the divisors d of n | 3.2958 = ln(27) |
A function that detects prime powers
Read the definition as a filter. Factor n. If the factorization has exactly one distinct prime - n = p^k for some prime p and exponent k >= 1 - then Lambda(n) = ln p, the logarithm of that prime (not of n). If the factorization has two or more distinct primes, or n = 1, Lambda(n) = 0. The exponent does not matter: Lambda(2) = Lambda(4) = Lambda(8) = Lambda(1024) = ln 2.
The three worked cases show the filter's edges. 8 passes with base 2. 27 passes with base 3. 12 fails - it has plenty of prime factors, but they belong to two different primes, and the filter demands a single prime accounting for the whole number. Primes themselves pass trivially (k = 1), which is what makes Lambda a prime detector with prime powers included as a bonus.
- Lambda(n) = ln p if n = p^k, else 0
- Lambda(8) = 0.6931 (ln 2); Lambda(27) = 1.0986 (ln 3); Lambda(12) = 0
- The exponent is irrelevant: Lambda(2) = Lambda(1024) = ln 2
- Lambda(1) = 0 - 1 is not a prime power
The divisor identity
For every n, the sum of Lambda(d) over all divisors d of n equals ln n. The reason is transparent once seen: the divisors of n that are prime powers contribute ln p once for each power of each prime dividing n, and those contributions reassemble exactly the prime factorization of n in logarithmic form. The calculator performs this sum on every input and reports it next to ln n, so the identity is verified, not merely asserted.
In fancier language, Lambda is the Dirichlet convolution inverse partner of the constant-1 function against log: log = 1 * Lambda. That single identity is the seed from which the explicit formulae grow - differentiate the zeta function's logarithm and Lambda appears as the coefficient sequence, which is why it, and not the raw prime indicator, is the natural weight in analytic arguments.
- Sum over divisors: sum Lambda(d) = ln n, verified on every input
- Equivalently log = 1 * Lambda as Dirichlet convolution
- -zeta'(s)/zeta(s) has Lambda(n) as its Dirichlet coefficients
Where Lambda does its work
The first job is psi: Chebyshev's second function is exactly psi(x) = sum of Lambda(n) for n <= x. Every statement about psi - its asymptotic, its explicit formula - is a statement about accumulated Lambda values. The Chebyshev page computes psi directly from primes and prime powers; computing it as a Lambda sum gives the same numbers, and the agreement between the two routes is the divisor identity at work in bulk.
The second job is the explicit formula: pi(x), in its weighted forms, equals a main term minus a sum over the nontrivial zeros of zeta, and the derivation runs through Lambda because -zeta'/zeta is the generating function whose coefficients are Lambda(n). When analytic number theorists say the primes are governed by the zeros, the von Mangoldt function is the mechanism of that governance.
| n | Factorization | Prime power? | Lambda(n) |
|---|---|---|---|
| 8 | 2^3 | Yes - power of 2 | 0.6931 |
| 12 | 2^2 x 3 | No | 0.0000 |
| 27 | 3^3 | Yes - power of 3 | 1.0986 |
| 30 | 2 x 3 x 5 | No | 0.0000 |
| 49 | 7^2 | Yes - power of 7 | 1.9459 |
Prime powers, enumerated
It helps to see the filter's output on a short range. Nonzero values below 30 occur at the primes 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 (each contributing its own logarithm) and at the proper prime powers 4, 8, 9, 16, 25, 27 (contributing ln 2, ln 2, ln 3, ln 2, ln 5, ln 3). Everything else - 1, 6, 10, 12, 14, 15, 18, 20, 21, 22, 24, 26, 28 - is zero. The zeros are the majority even in this small window, and their share grows with the range.
Notice the pattern in the nonzero values: Lambda only ever takes values ln p. The function's entire range is the set of logarithms of primes. That rigidity is the point - Lambda converts the multiplicative structure of n into additive prime data, one prime at a time.
From Lambda to the zeros of zeta
The deepest fact about Lambda is packaged in its Dirichlet series: the sum of Lambda(n) / n^s equals -zeta'(s) / zeta(s), the negative logarithmic derivative of the Riemann zeta function. Take the logarithmic derivative of Euler's product for zeta and the identity falls out in two lines - and with it, the reason Lambda has its peculiar form: the prime powers in the Euler factors generate exactly the terms ln p at n = p^k, and nothing else.
From that series, Perron's formula produces the explicit formula for psi: psi(x) equals x minus a sum over the nontrivial zeros of zeta, minus smaller terms. Every oscillation of the primes around their expected density is accounted for by those zeros. The prime number theorem itself - psi(x) ~ x, which the Chebyshev page watches through its ratios - is equivalent to zeta having no zeros on the line Re(s) = 1.
So the modest filter evaluated by this calculator - ln p for prime powers, 0 otherwise - is the coefficient-level mechanism connecting prime counting to the most famous unsolved problem in mathematics. The Riemann Hypothesis, in one of its equivalent forms, is a statement about how regularly these Lambda values accumulate.
Lambda also has a multiplicative personality worth stating: it is not multiplicative itself, but it is the Dirichlet convolution of mu with log - Lambda = mu * log in the convolution algebra, which is the Möbius-inversion dual of the divisor identity log = 1 * Lambda shown on this page. The two identities are the same fact read in opposite directions, and together they are the engine of the elementary proof techniques for average orders of arithmetic functions.
- Sum of Lambda(n)/n^s equals -zeta'(s)/zeta(s)
- psi(x) has an explicit formula: x minus a sum over the zeros of zeta
- PNT is equivalent to zeta having no zeros with real part 1
Lambda in computations: summatory behaviour
Sum Lambda over a range and you recover psi: the values at prime powers are sparse but the accumulation is steady - up to 10 the sum is 7.8320 (that is psi(10)), and the contributions come only from 2, 3, 4, 5, 7, 8, 9 - seven nonzero terms among ten integers. Up to 100 the sum is psi(100) = 94.0453, built from 25 prime contributions and a handful of prime-power ones. The calculator's divisor-identity check is the local version of the same bookkeeping: at every n, Lambda's divisor sum rebuilds ln n exactly.
For computation, Lambda's sparsity is the point: a summatory pass over a range touches only primes and prime powers, so psi(x) can be evaluated by sieving primes and adding prime-power corrections - exactly the two-part structure the Chebyshev page displays. The functions are one theory wearing two interfaces, and this site's pair of pages mirrors that.
- Sum of Lambda(n) for n <= 10 is psi(10) = 7.8320, from just 7 nonzero terms
- Sum to 100 is psi(100) = 94.0453
- Sparsity makes psi computable by sieve plus prime-power corrections
FAQs
What is the von Mangoldt function?
Lambda(n) equals ln p when n is a power of a single prime p, and 0 otherwise. Lambda(8) = ln 2 = 0.6931 because 8 = 2^3; Lambda(12) = 0 because 12 mixes the primes 2 and 3.
Why is Lambda(12) equal to 0?
12 = 2^2 x 3 involves two distinct primes, so 12 is not a prime power. The von Mangoldt function is nonzero only when one prime accounts for the whole number.
What is Lambda(27)?
ln 3 = 1.0986, because 27 = 3^3 is a power of the single prime 3. The exponent does not matter - Lambda(3), Lambda(9) and Lambda(27) are all ln 3.
What is the divisor identity for the Mangoldt function?
Summing Lambda(d) over all divisors d of n always gives ln n. The calculator performs this sum on every input and displays it next to ln n as a cross-check.
Is Lambda(1) zero?
Yes. 1 is not a prime power - it has no prime factor at all - so Lambda(1) = 0, consistent with the divisor identity since ln 1 = 0.
How is the Mangoldt function used in prime number theory?
Its partial sums are Chebyshev's psi function - psi(x) is the sum of Lambda(n) for n up to x - and its Dirichlet series is -zeta'(s)/zeta(s), which is the route to the explicit formulae connecting primes with the zeros of the zeta function.