2026-09-29 8 min

Möbius Function Calculator

Compute μ(n) with full prime factorization, squarefree verdict, and parity of distinct prime factors.

Calculator

Möbius Function Inputs

Integer (n)
Results update live as you type
Status:μ(30) = -1squarefree · k=3

Möbius Summary

μ(n)-1
Factorization2 × 3 × 5
Verdictsquarefree, k=3

Results

Optimal

μ(n)

-1

Möbius value: −1, 0, or +1

Squarefree

Yes

Whether any squared prime divides n

Distinct primes (k)

3

Count of distinct prime factors

Factorization

2 × 3 × 5

Prime-power decomposition

Square part

1

Product of p^(even part of exponent)

μ(n) by complete trial-division factorization; squarefree verdict and (−1)^k parity shown with every step.

Visualizations

Prime exponents

12
13
15

μ across 1..n (sampled)

Distinct primes vs total size

k / log₂(n)3

Square part vs n

square part1

Formula

The Möbius function is zero on non-squarefree integers and records the parity of the distinct-prime count otherwise.

μ(1) = 1; μ(n) = 0 if p² | n; else μ(n) = (−1)^k

Alternative Form

Σ_{d|n} μ(d) = 1 if n = 1 else 0 (Möbius inversion identity)

Variables

SymbolNameUnitDescription
nInputintegerPositive integer 1–10,000,000
k = ω(n)Distinct primescountNumber of distinct prime factors
μ(n)Result−1 / 0 / +10 if squareful, else (−1)^k
p² | nSquare divisorintegerAny squared prime dividing n forces μ = 0

Explanation

Factor first, scan exponents for repeats, then read parity: even k gives +1, odd k gives −1.

Derivation

For squarefree n = p₁…pₖ, μ(n) = (−1)^k by definition; if any p²|n the value is 0. Summatory identity Σ_{d|n} μ(d) = [n=1] underpins Möbius inversion.

Step-by-Step Calculation

Follow each step to understand how the result is calculated from your inputs.

Step 1

Read the input.

Input: n
n:30
Result: n = 30
Step 2

Factor n by trial division up to √n.

n = ∏ p^e
Intermediate: 2 × 3 × 5
Result: 3 distinct prime(s)
Step 3

Test every exponent for a square.

squarefree ⟺ all e = 1
p=2:e=1
p=3:e=1
p=5:e=1
Result: Squarefree — no exponent ≥ 2
Step 4

Count distinct primes k.

k = ω(n)
Intermediate: k = 3
Result: Parity: odd
Step 5

Apply the Möbius rule.

μ = 0 if squareful, else (−1)^k
Intermediate: (−1)^3
Result: μ(30) = -1
Step 6

Verify by direct check.

μ ∈ {−1, 0, +1}
Intermediate: square part 1 divides 30
Result: Confirmed: 2 × 3 × 5 → μ = -1
Final Answer
-1

Worked Examples

See how the calculator works with different scenarios.

Scenario

Three distinct primes.

Inputs

n:30

Calculation

30 = 2×3×5, k=3 odd → μ = −1

Result

μ(30) = −1

Interpretation

Odd distinct-prime count gives −1.

Understanding Your Result

Your Result: μ(n) — see the result card (−1, 0, or +1 with the squarefree verdict).

Typical range: Only −1, 0, +1. About 60.8% of integers (6/π²) are squarefree, so ±1 slightly outnumber zeros.

What This Means

Zero means a squared prime divides n; ±1 records whether the distinct-prime count is even (+1) or odd (−1).

Why It Matters

μ powers Möbius inversion, totient identities, and prime-distribution analysis via the Mertens function.

Professional Interpretation

A zero flags repeated factors (bad for squarefree-dependent theorems); ±1 confirms a clean squarefree input for inversion formulas.

Recommendations

  • •Quote factorization with μ
  • •Check squarefree before inversion
  • •Use k parity to sanity-check sign
  • •Cap trial division at 10⁷
  • •Sum μ for Mertens estimates

Educational Content

Introduction

The Möbius function compresses the whole factorization of n into a single −1, 0, or +1 with deep analytic meaning.

Concept Explanation

Squareful inputs collapse to 0; squarefree inputs reduce to the parity (−1)^k of their distinct-prime count.

Applications

▸Möbius inversion formulas
▸Totient summatory relations
▸Mertens function and RH studies
▸Inclusion–exclusion counting
▸Dirichlet convolution
▸Squarefree density estimates

Benefits

  • •Instant μ with proof trace
  • •Squarefree verdict included
  • •Full factorization shown
  • •Parity reasoning visible
  • •Inversion identity cross-check

Limitations

  • •Trial division to 10⁷
  • •Single value, not summatory
  • •No Pollard-rho for giants

Best Practices

  • •State n with its factorization
  • •Name the squared prime when μ=0
  • •Quote k when μ=±1
  • •Verify Σ_{d|n} μ(d)
  • •Respect the input cap

Common Misconceptions

Myth: μ(1) = 0.
Truth: μ(1) = +1 — the empty product has zero (even) prime factors.
Myth: μ counts total prime factors.
Truth: It counts distinct primes only, and only when all exponents are 1.
Myth: μ = −1 means composite "bad".
Truth: The sign is pure parity, not a quality judgment.
Myth: Large n always gives μ = 0.
Truth: Density of squarefree numbers is 6/π² ≈ 61% at any scale.

Practical Tips

  • •Factor fully before judging μ
  • •Any exponent ≥ 2 means μ = 0 at once
  • •Even k → +1, odd k → −1
  • •Remember μ(1) = +1
  • •Name the squared prime in reports
  • •Cross-check with Σ_{d|n} μ(d)
  • •Stay at n ≤ 10,000,000 here

Common Mistakes

Counting multiplicity instead of distinct primes
12 = 2²×3 has k=2 (not 3): but μ=0 anyway from the repeat.
Assigning μ(1) = 0
Use +1; the inversion identity Σ_{d|1} μ(d)=1 requires it.
Missing a squared large prime
Trial-divide to √n completely before declaring squarefree.
Reading μ=0 as an error
Zero is a valid answer meaning "not squarefree".
Using μ past the trial-division cap
Cap at 10⁷ or switch to a sieve / Pollard-rho implementation.

Assumptions

This calculator makes the following assumptions to provide estimates:

Positive integer: n ≥ 1; non-integers are rejected.
Trial division scope: n ≤ 10,000,000 keeps √n loops instant.
Exact integer math: Division steps use integer remainders.
Standard definition: μ(1)=1; 0 on squareful; (−1)^k else.
Local only: No server calls; pure client math.

Limitations

Be aware of these limitations when using this calculator:

Input cap: Above 10⁷ trial division slows; use advanced factoring.
Single value: Summatory Mertens M(x) needs a separate loop.
Display rounding: Huge factorizations truncate in charts.
No symbolic proof: Numeric factorization only, not formal proof.

Frequently Asked Questions

Answers to common questions about this calculator.

What is the Möbius function?
μ(1)=1; μ(n)=0 when a squared prime divides n; otherwise μ(n)=(−1)^k where k counts distinct prime factors.
What is μ(30)?
−1: 30 = 2×3×5 has three distinct primes (odd count), all exponent 1.
Why is μ(12) = 0?
12 = 2²×3 contains the squared prime 2², so it is not squarefree.
What does squarefree mean?
No squared prime divides n — every prime exponent in its factorization is 0 or 1.
What is μ used for?
Möbius inversion converts between summatory functions (e.g. relating φ and the identity, or the prime-counting connection behind the Mertens function).
What is the Mertens function?
M(x) = Σ μ(n) for n ≤ x; its growth is tied to the Riemann hypothesis (|M(x)| = O(x^{1/2+ε})).
Is μ(1) = 1 or 0?
1 by convention — the empty product has zero prime factors (even).
Why the 10,000,000 cap?
Trial division up to √n stays instant below 10⁷; larger inputs need a sieve or Pollard-rho.
μ = 1 vs −1 — which is "good"?
Neither; the sign only records parity of the distinct-prime count.
Can μ be anything besides −1, 0, 1?
No — the definition only ever returns those three values.

Related Calculators

Explore more calculators related to this topic.

Related Guides

Deepen your understanding with these educational resources.

Glossary

Technical terms used in mortgage calculations explained in plain language.

Möbius function μ
−1/0/+1 encoding squarefreeness and prime-count parity.
Squarefree
No squared prime divides n.
Distinct-prime count ω(n)
k = number of different primes dividing n.
Möbius inversion
Recovering f from its divisor sums via μ weights.
Mertens function
M(x) = cumulative μ sum; linked to the Riemann hypothesis.
Trial division
Factoring by testing divisors up to √n.
Dirichlet convolution
Divisor-sum product where μ is the inverse of 1.
6/π² density
Asymptotic share (~60.8%) of squarefree integers.

Authoritative References

Trusted sources and standards referenced by this calculator.

Applicable Standards

Common Core HSA-SSE.B — structure of integer expressionsNCTM Number and Operations — prime factorization and divisibility

Was This Calculator Helpful?

Page Information

Last Updated:

2026-09-29

Version:

2.0.0

License:

Free to use for educational and professional purposes.