gives the von Mangoldt function
.
MangoldtLambda
gives the von Mangoldt function
.
Details
- MangoldtLambda is also know as von Mangoldt function.
- Integer mathematical function, suitable for both symbolic and numerical manipulation.
- MangoldtLambda[n] gives zero unless n is a prime power, in which case it gives the logarithm of the prime.
- For a positive integer n= p1k1⋯ pmkm with pi primes, MangoldtLambda[n] returns 0 unless m is equal to 1, in which case it gives Log[p1].
Examples
open all close allBasic Examples (2)
Compute the Mangoldt function at
:
MangoldtLambda[25]Plot the MangoldtLambda sequence for the first 100 numbers:
DiscretePlot[MangoldtLambda[n], {n, 100}]Scope (8)
Numerical Evaluation (3)
MangoldtLambda works over integers:
MangoldtLambda[125]MangoldtLambda[7 ^ 300]MangoldtLambda threads over lists:
MangoldtLambda[{2, 6, 9, 8, 15}]Symbolic Manipulation (5)
TraditionalForm formatting:
MangoldtLambda[n]//TraditionalFormReduce[MangoldtLambda[n] == Log[2] && 0 < n < 10, n, Integers]Solve[MangoldtLambda[a + b ^ 2] == Log[b] && 0 < a < 10 && 0 < b < 10, {a, b}, Integers]Sum of MangoldtLambda over divisors:
DivisorSum[x, MangoldtLambda[#]&]DirichletTransform of MangoldtLambda:
DirichletTransform[MangoldtLambda[n], n, s]Sum[MangoldtLambda[k] / k ^ s, {k, 1, Infinity}]Applications (5)
Basic Applications (3)
Highlight numbers n for which
in blue, and the prime bases of numbers n for which
in red:
Multicolumn[If[MangoldtLambda[#] == 0, Style[#, Blue, Bold], Style[Exp[MangoldtLambda[#]], Red, Bold]]& /@ Range[100], 10, ...]Compare MangoldtLambda sequence with logarithm function:
Show[LogPlot[x, {x, 1, 100}, PlotStyle -> Orange],
ListLinePlot[MangoldtLambda[Range[100]]]]Plot the second Chebyshev function: [more info]
ψ[x_] := Total@MangoldtLambda[Range[Floor[x]]];Demonstrate that it is asymptotic with
:
DiscretePlot[ψ[x] / x, {x, 200}]Number Theory (2)
Use MangoldtLambda to test for a prime power:
MangoldtLambda[81] ≠ 0PrimePowerQ[81]Plot an approximation of the number of primes and prime powers using MangoldtLambda and ZetaZero:
f[x_, n_] := Module[{zero = Flatten[N[Table[ZetaZero[{j, -j}], {j, n}]]]}, x - Log[2 Pi] - Total[x ^ zero / zero] - Log[1 - 1 / x ^ 2] / 2];
g[x_] := Sum[MangoldtLambda[j], {j, 1, Floor[x]}];
vis[n_] := Plot[{g[x], f[x, n]}, {x, 2, 15}, Exclusions -> None, Frame -> True, PlotRange -> {0, 15}, PlotLegends -> {g, f}];vis[1]The more zeros used, the closer the approximation:
vis[15]Properties & Relations (7)
MangoldtLambda gives zero except for prime powers:
MangoldtLambda[2 3]MangoldtLambda[2 ^ 3]MangoldtLambda is neither additive or multiplicative:
{MangoldtLambda[2 3], MangoldtLambda[2] + MangoldtLambda[3]}{MangoldtLambda[2 3], MangoldtLambda[2]MangoldtLambda[3]}MangoldtLambda satisfies the identity
:
Log[16] == DivisorSum[16, MangoldtLambda[#] &]Use MoebiusMu to compute MangoldtLambda:
DivisorSum[n, MoebiusMu[n / #] Log[#] &]Use LCM to compute MangoldtLambda:
Log[ LCM@@Range[5] / LCM@@Range[4]]MangoldtLambda[5]The sum of MangoldtLambda of the first n integers is equal to the natural log of the LCM of the first n integers:
Sum[MangoldtLambda[n], {n, 20}]//SimplifyLog[Apply[LCM, Range[20]]]MangoldtLambda satisfies the following identities:
n = 16;Log[n] == DivisorSum[n, MangoldtLambda[#] &]DivisorSum[n, MoebiusMu[n / #] Log[#]&] == MangoldtLambda[n]DivisorSum[n, MoebiusMu[#] Log[#]&] == -MangoldtLambda[n]DivisorSum[n, MoebiusMu[n / #] MangoldtLambda[#]&] == -MoebiusMu[n] Log[n]Neat Examples (3)
Plot MangoldtLambda for the sum of two squares:
ArrayPlot[Table[MangoldtLambda[a ^ 2 + b ^ 2], {a, 50}, {b, 50}], ColorFunction -> "BlueGreenYellow"]Plot the arguments of the Fourier transform of MangoldtLambda:
ArrayPlot[Arg[Fourier[Table[MangoldtLambda[m + n], {m, 200}, {n, 200}]]], ColorFunction -> Hue]Plot the Ulam spiral of MangoldtLambda:
ulam[n_] := Partition[Permute[Range[n ^ 2], Accumulate[Take[Flatten[{{n ^ 2 + 1} / 2, Table
[(-1) ^ j i, {j, n}, {i, {-1, n}}, {j}]}], n ^ 2]]], n];ArrayPlot[MangoldtLambda[ulam[101]], ColorFunction -> "Rainbow"]See Also
FactorInteger PrimePowerQ DirichletTransform PrimePi Zeta ZetaZero MoebiusMu
Function Repository: ChebyshevPsi
Related Guides
History
Text
Wolfram Research (2008), MangoldtLambda, Wolfram Language function, https://reference.wolfram.com/language/ref/MangoldtLambda.html.
CMS
Wolfram Language. 2008. "MangoldtLambda." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MangoldtLambda.html.
APA
Wolfram Language. (2008). MangoldtLambda. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MangoldtLambda.html
BibTeX
@misc{reference.wolfram_2026_mangoldtlambda, author="Wolfram Research", title="{MangoldtLambda}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/MangoldtLambda.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_mangoldtlambda, organization={Wolfram Research}, title={MangoldtLambda}, year={2008}, url={https://reference.wolfram.com/language/ref/MangoldtLambda.html}, note=[Accessed: 13-June-2026]}