Arithmetic Functions: Definitions and Examples
How many divisors does 5,040 have? How many integers below a million are coprime to it? How is an integer built from primes? Each question has an answer. That answer depends only on the integer itself. Yet the rules producing these answers look nothing alike at first glance. Number theory organizes all of them under a single unifying concept: the arithmetic function, a rule assigning a complex number to each positive integer. This idea matters because it turns number theory into an algebraic and analytic playground. Divisor counts, sums of divisors, prime factorization data, and coprimality counts can all be recognized as functions on the same domain. Once this is done, one can add them, multiply them, and compose them under new operations. One can also ask about their growth, average size, and special values. The apparent chaos of "how numbers factor" becomes a structured study of functions with rich internal patterns. Some are multiplicative, some additive, some neither. Yet all are built from the same divisibility data every reader already knows. The big picture is this: an arithmetic function is deliberately a very weak kind of object. It is just a sequence of complex numbers indexed by . But the ones number theory actually cares about are never arbitrary. They arise from counting divisors, from prime factorizations, from Euler's totient, from Möbius's alternating sign trick. Recognizing the common domain and codomain of these examples is a necessary first step. Only then can one define the algebraic structures — multiplicativity, Dirichlet convolution — that make the subject computationally powerful. This article gives the formal definition of an arithmetic function. It develops the canonical examples in full rigorous detail: the divisor function, the sum-of-divisors function, Euler's totient, the Möbius function, the Liouville function, and the von Mangoldt function. It proves their basic defining formulas from first principles. It also sets up — without yet proving — the multiplicative structure that later material builds upon.
- An arithmetic function is any function ; no further structure is assumed a priori.
- The set of all arithmetic functions forms a -vector space under pointwise addition and scalar multiplication.
- Canonical examples: (number of divisors), (sum of divisors), (Euler's totient), (Möbius function), (Liouville function), (von Mangoldt function).
- Each example is computed directly from the prime factorization , giving closed formulas that are proved rigorously here.
- These functions later turn out to be multiplicative — a structural property studied as its own topic and combined via Dirichlet Convolution.
- Key idea: collapsing many different divisibility-counting problems into one common object — a function on — is what lets number theory apply uniform algebraic and analytic tools to all of them at once.
Where this lives today
The divisor and totient functions are the computational backbone of RSA cryptography: key generation depends on computing for an RSA modulus , and the security of the scheme rests on the hardness of factoring (equivalently, of computing ) without knowing individually. The Möbius function underlies Möbius inversion, a technique used across combinatorics, algebraic topology (inclusion–exclusion on posets), and analytic number theory to invert divisor sums. The von Mangoldt function is the central object in the analytic proof of the Prime Number Theorem, appearing in the logarithmic derivative of the Riemann zeta function. The Liouville function appears in equivalent reformulations of the Riemann Hypothesis via the Pólya conjecture and related summatory-function identities. In computer science, fast computation of , , and from a factorization is a standard subroutine in computational number theory libraries, and average-order estimates for these functions (their typical size as ranges over large intervals) are a staple topic in analytic number theory and probabilistic number theory alike.
Ask the tutor: How do the closed formulas for , , and all follow from a single unifying property called multiplicativity?
An arithmetic function (also called a number-theoretic function) is any function
That is, assigns to every positive integer a complex number , subject to no further condition. The set of all arithmetic functions is denoted . Two arithmetic functions are added and scaled pointwise:
Under these operations is a -vector space (indeed it is exactly the space of all functions , so vector-space axioms are inherited directly from those of ). The definition imposes no continuity, no growth restriction, and no algebraic compatibility with multiplication of integers. Multiplicativity, when it is discussed, is an extra property that specific arithmetic functions may or may not possess — it is not part of the definition of "arithmetic function" itself.
Intuition
Think of an arithmetic function as an infinite table: row , entry . The table has one row for every positive integer and can otherwise contain absolutely anything — a constant, a random-looking sequence, or (the interesting case) a value computed from how factors into primes. What makes number theory possible is that the specific tables arising from divisor-counting, factorization, and coprimality turn out to interact beautifully with multiplication of the inputs , even though the definition says nothing about multiplication at all. A helpful mental picture is to fix a small integer, say , and watch how several canonical arithmetic functions read off different pieces of the same factorization data: counts its six divisors, adds them up, counts integers below coprime to it, because has a squared prime factor, because it has an even number of prime factors with multiplicity, and because is not a prime power. One integer, six numbers, one underlying structure: the prime factorization.
Notice the theme: every value is computed from the same factorization , just read off in a different way — count the exponents-plus-one products, sum divisors, count coprime residues, detect square factors, count prime factors with sign, or detect prime-power status. This shared dependence on factorization is exactly what later analysis exploits when studying Multiplicative Functions and combining them via Dirichlet Convolution.
Let be a positive integer with prime factorization
(with the convention that corresponds to the empty product, ). Define the following arithmetic functions: 1. Divisor function : the number of positive divisors of . 2. Sum-of-divisors function : the sum of the positive divisors of . 3. Euler's totient : the number of integers with and . 4. Möbius function : defined by ; if has a square factor ; and if is a product of distinct primes. 5. Liouville function : defined by , where is the number of prime factors of counted with multiplicity (). 6. Von Mangoldt function : defined by if for some prime and integer , and otherwise. Then, for :
and .
We prove the three closed formulas in turn, each by directly analyzing divisors of via unique factorization. Throughout, is the prime factorization of guaranteed to exist and be unique by the Fundamental Theorem of Arithmetic (an already-known prerequisite result, used here only as the basic fact that every integer factors uniquely into primes up to order).
Step 1: Characterizing the divisors of . Claim: is a positive divisor of if and only if
() If has this form, then is a positive integer (each exponent ), so . () Suppose , so for some positive integer . Factor and into primes; by unique factorization, the multiset of prime factors of (namely with multiplicity , ..., with multiplicity ) is the union of the multisets of prime factors of and . In particular, no prime other than can divide (else it would divide , contradicting the factorization of ), and if exactly divides then , since the total multiplicity of across and must equal . This proves the claim.
Step 2: The divisor-counting formula for . By Step 1, divisors of correspond bijectively to tuples with , via recovering ; this map is a bijection precisely because distinct tuples give distinct integers (again by uniqueness of factorization: two products whenever the exponent tuples differ). The number of such tuples is, by the multiplication principle (each independently ranges over values ):
For the only divisor is itself, so , matching the empty product convention.
Step 3: The divisor-sum formula for . Using the same bijection, summing over all divisors is summing over all tuples with . This sum factors as a product of independent sums, one per prime, because
which is the standard distributive-law expansion of a product of sums into a sum of products (each term on the left, a specific choice of all 's, appears exactly once on the right when the product is expanded). Each inner sum is a finite geometric series:
(valid since , so the standard geometric series identity for applies). Substituting gives
For , trivially (only divisor is ).
Step 4: The totient formula for , via inclusion–exclusion. We count integers with . By definition of gcd and the prime factorization of , if and only if shares at least one of the primes with , i.e. for some . So
where . Since , exactly multiples of lie in , so . More generally, for any subset , the integers in divisible by every with are exactly the multiples of (since the are distinct primes, divisibility by all of them is equivalent to divisibility by their product), and since divides , there are exactly such multiples in . By the inclusion–exclusion principle applied to the sets :
Therefore
(absorbing the term, which contributes , and flipping signs to unify the summation over all subsets ). Now factor this sum over subsets as a product:
again by the distributive expansion of a product of two-term factors into a sum over all subsets (choosing the "" term for and the "" term otherwise reproduces exactly the sign and factor ). Hence
For there are no primes to exclude, the empty product is , and indeed (only in range, and ). This completes the proof of all three closed formulas. The definitions of , , stated in the theorem are formulas already given directly in terms of the prime factorization, requiring no further derivation — they are definitions, not consequences to be derived, and are recorded here precisely so that later results (multiplicativity of and , the fundamental identity under Dirichlet convolution) have an unambiguous starting point.
∎Worked examples
Example 1: . Factor , so with , , . Divisor count. By the theorem,
Check by direct listing: the divisors of are
and counting gives exactly entries, confirming the formula. Sum of divisors.
As a sanity check, summing the divisors listed above:
which matches. Totient.
Möbius, Liouville, von Mangoldt. Since has a squared prime factor (, in particular already ), . Since is even, . Since is not a prime power (it has three distinct prime factors), .
Example 2: . This is a product of three distinct primes, each to the first power, so , all . Divisor count. . Direct check: divisors are — exactly numbers. Sum of divisors.
Direct check: . ✓. Totient.
Compute stepwise: , so first factor gives . Then , so . Then , so . Hence . Möbius, Liouville, von Mangoldt. Since is squarefree with distinct prime factors, . Since is odd, (agreeing with here, as always happens for squarefree , since then ). Since has three distinct prime factors, it is not a prime power, so . These two examples deliberately use non-symmetric, composite factorizations (different exponents, different prime patterns) so that every step of the formulas — the geometric series in , the subtraction pattern in , the case distinctions in — is genuinely exercised rather than trivialized.
The formula
is proved above by summing over primes that are pairwise distinct divisors of ; the inclusion–exclusion argument in Step 4 crucially uses that correctly counts multiples divisible by all simultaneously, which requires the to be distinct primes (so that "divisible by the product" is equivalent to "divisible by each factor"). If one instead — incorrectly — tries to run the same product formula using the prime factorization with multiplicity, i.e. using each prime factor listed times instead of once, the formula breaks down. Concretely take . The correct formula (using the distinct prime once) gives
which matches direct counting: among , the integers coprime to are , so . But if one mistakenly used the multiplicity-repeated "factorization" (treating each of the three copies of the prime as contributing its own factor ), one would compute
which is wrong — it does not equal . This shows the hypothesis " are the distinct primes dividing " in the theorem is not a cosmetic bookkeeping choice: dropping distinctness and instead ranging over prime factors with multiplicity gives a genuinely false formula, because the inclusion–exclusion count of multiples of a squared prime power like inside is not the same as counting multiples of twice independently — sets built from repeated copies of the same prime are not distinct events that combine multiplicatively in the inclusion–exclusion sense used in the proof.
Scope, edge cases & common traps
| Situation | What to watch for |
|---|---|
| Empty product convention: , , (), (not a prime power). | |
| prime | , , , , , . |
| squarefree | where is the number of prime factors (they coincide exactly when is squarefree, since then ). |
| has a squared prime factor | always; is still generally nonzero (it only depends on parity of , not on repetition). |
| a prime power , | even though is not prime — a frequent point of confusion, since detects prime powers, not primes. |
| Confusing and | They agree on squarefree but differ once a square factor appears: but . |
The mathematician behind it
Origins · 1 minLeonhard Euler and how this was discovered
Euler is the figure most responsible for introducing systematic arithmetic functions into number theory, most notably his totient function , which he used in generalizing Fermat's Little Theorem to composite moduli. His work established the pattern — factor an integer, extract a number from the factorization, study how that number behaves — that this entire branch of number theory still follows.
Is every arithmetic function required to be multiplicative?
No. The definition of an arithmetic function only requires it to be a function from to ; nothing about how it interacts with products of integers is assumed. Multiplicativity — the property that whenever — is a separate, extra structural property that some arithmetic functions (like , , , , ) happen to satisfy and others do not. Recognizing which functions are multiplicative, and why, is the subject of a later, dedicated treatment; here the point is only that the raw definition is deliberately unconstrained, so that all these functions and many "badly behaved" ones (for instance 's digit sum) fall under the same umbrella term.
Why does μ(n) = 0 whenever n has a squared prime factor?
This is simply part of the definition of , not a derived fact requiring separate proof, but its motivation comes from Möbius inversion, where is engineered to make certain divisor sums telescope to zero except in a single case. Concretely, if for some prime , the theorem's definition assigns directly; there is no computation to do — one only needs to detect whether 's factorization has any exponent . This is different from , whose values are always positive integers computed by a formula; instead only ever takes the three values , and the value acts as a flag for "non-squarefree."
What is the difference between μ(n) and λ(n)?
Both depend on the prime factorization of and both take values in conceptually, but never actually equals — it always equals , because (prime factors counted with multiplicity) is always a well-defined nonnegative integer. By contrast equals whenever has any repeated prime factor. They agree exactly on squarefree integers, since there equals the number of distinct prime factors , matching the exponent in . On non-squarefree integers they diverge: e.g. but .
Why is Λ(n) defined using log p rather than just an indicator of prime powers?
The choice of (rather than, say, the constant ) is designed so that interacts correctly with the logarithm of under Dirichlet convolution, giving the clean identity . This identity, provable directly from unique factorization, is the reason becomes indispensable in the analytic proof of the Prime Number Theorem: it converts additive information about into a divisor-sum that isolates prime-power locations. Without the logarithmic weighting, one would only get a cruder "prime power indicator" function, losing this convolution identity and its analytic consequences entirely.
Can two different-looking arithmetic functions be equal as functions?
Yes, and this is a common point of confusion: two arithmetic functions are equal (as elements of ) precisely when they agree at every positive integer , regardless of how differently their defining formulas are written. For instance, and are different functions in general (they disagree at , for instance) but agree at every squarefree ; this is a partial, not total, equality. Establishing full equality of two arithmetic functions in general requires either a direct term-by-term proof for every , or an identity provable via Dirichlet convolution / generating function techniques, covered under Dirichlet Convolution.
Does the formula for σ(n) only work when n is a prime power?
No — the formula works for any positive integer with prime factorization , including with many distinct prime factors, as proved in Step 3 above using the distributive expansion of a product of independent geometric sums. It happens to specialize, when (i.e. is a prime power), to the single geometric series , but the general multi-prime case is the actual content of the theorem, verified explicitly for (three distinct primes) and (three distinct primes, all exponent ) above.
Is τ(n) ever equal to n itself, and what does that reveal about the definition?
Only for (where ) and (where ); for every , because counts divisors while has at least non-divisors among once , and in fact the growth rate of is known to be far smaller than on average (its average order is , a fact from analytic number theory building on these same definitions). This illustrates a broader point: while an arithmetic function's definition imposes no growth restriction whatsoever, the canonical examples introduced here turn out, upon further study, to have very specific, provable growth behaviors — a phenomenon investigated once the algebraic tools of multiplicative functions and Dirichlet convolution are available.