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.

Description

Mertens’ function is the cumulative sum of Möbius values.

Mertens’ function is the cumulative sum of Möbius values. Square factors contribute zero, while square-free integers contribute signs determined by their number of distinct prime factors.1

The tool returns value. The indexing and output conventions below determine how to read these values.

When to use Mertens Function

Use this for the following task: 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. Use the input and output conventions below to reproduce the intended mathematical quantity.

How to use Mertens Function and understand its results

  1. Choose the required indexes, integers or sequence entries. Preserve decimal-string encodings where the field table specifies strings.
  2. Enter n according to the field table, then run the tool.
  3. Read value. Use the stated units, indexing and interpretation of the numerical result.
  4. Keep exact decimal strings for subsequent integer arithmetic; distinguish them from any explicitly approximate numeric result.
Input fieldMeaningValue type and boundsRequirement
nNonnegative summation limit (sieve resource limit 1000000)integer; minimum 0; maximum 1000000Required

Sieve primes through n, flip signs at multiples of each prime and set multiples of prime squares to zero. Sum the resulting Möbius values through the inclusive limit.

M(n)=Σ[k=1..n]μ(k)

The symbols and boundary conditions refer to the supplied fields and the implementation described above.

Output fieldMeaningValue type
valueMertens summatory Möbius valueinteger
json
{
  "input": {
    "n": 10
  },
  "output": {
    "value": -1
  }
}

Limitations and assumptions

The limit is at most one million and M(0)=0. A finite computed prefix does not establish bounds or conjectures about the function at larger inputs.

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 Liouville Lambda Function when you need its operation: Return λ(n)=(−1)^Ω(n), counting prime factors with multiplicity and using λ(1)=1; trial division is limited to n≤10¹². Choose Möbius Inversion of Divisor Sums for the complementary operation: Recover f(1)…f(N) from F(n)=Σ(d|n)f(d) by exact triangular divisor-sum inversion; prefixes start at one and are capped at 1,000 entries.

Background reference: OEIS A002321.

References

  1. OEIS A002321 — OEIS Foundation

Similar or alternative tools

  • Liouville Lambda Function

    Return λ(n)=(−1)^Ω(n), counting prime factors with multiplicity and using λ(1)=1; trial division is limited to n≤10¹².

  • Möbius Inversion of Divisor Sums

    Recover f(1)…f(N) from F(n)=Σ(d|n)f(d) by exact triangular divisor-sum inversion; prefixes start at one and are capped at 1,000 entries.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies