Valuations, residues and reciprocity
, where is the digit sum of in base .
It answers every "how many trailing zeros / what power of divides" question in one line: , and the digit-sum form confirms it since has digit sum and . Combined with Kummer's theorem — is the number of carries when adding and in base — it also controls binomial coefficients, which is where the olympiad applications live.
is if is a nonzero square mod , otherwise. Euler: . It is multiplicative in . Reciprocity: , with and .
Multiplicativity is what makes it fast: to test through modulo you evaluate eight prime symbols and multiply, finding residues — . Exactly half of the nonzero classes are squares, so a count near is the sanity check. The symbol is also the standard way to prove a Diophantine equation has no solutions: reduce mod a well-chosen prime and show one side is a non-residue.
with a positive non-square has infinitely many solutions; the fundamental one comes from the continued fraction of , and all others are .
The solutions grow fast, so searching is hopeless: for the smallest is , which no hand search finds. The continued fraction has odd period, so the first convergent of the period, , solves and its square solves . In olympiad use, Pell supplies the infinite family in "show there are infinitely many such that ..." and the recursion supplies the induction.
For odd with and : . The case needs for even . LTE plus Legendre's formula settles most "largest power of dividing" problems outright.
Is a quadratic residue modulo the prime ?
Step 1 — factor the top: , so .
Step 2 — and are both , so reciprocity flips the sign: .
Step 3 — , so no sign: , since .
Step 4 — so : is a square mod . (Euler's criterion confirms it: .)
How to find it. Factor the top into primes, flip each prime symbol with reciprocity, reduce the new top modulo the new bottom, and repeat — a Euclid-like descent in which only the supplements for and are ever evaluated directly.
Prove that divides for every . (folklore; used in Chebyshev-type prime estimates)
Step 1 — compare exponents prime by prime. For a prime , is the largest with , namely .
Step 2 — by Kummer, is the number of carries when is added in base .
Step 3 — a carry out of position produces a nonzero digit (or a new leading digit) in position of , so every carry happens at a position with . There are at most such positions.
Step 4 — so for every , which is the claim. Example: divides .
How to find it. Divisibility between two integers is a prime-by-prime comparison of valuations. Kummer turns the binomial's valuation into a digit count, and the lcm's valuation is also a digit count — the number of base- digits of , minus one.
Tempting: "compute , so is a square mod ." But the squares mod are , and is not among them.
The product is the Jacobi symbol, which obeys reciprocity but does not detect squares: is a non-residue both mod and mod , and two failures multiply to . By the Chinese remainder theorem, is a square mod exactly when it is a square mod and mod . The Jacobi symbol is safe for one thing: a value of proves non-residuosity. A value of proves nothing modulo a composite.
Find the exponent of in in two ways: with Legendre's formula, and by counting carries.
Show the answerHide the answer
Legendre: and , so . Kummer: , and adding carries out of each position holding a — three positions — so again . In general is the number of s in the binary expansion of .
Multiplicative functions and Möbius
(number of divisors), (their sum), (Euler totient) and (Möbius: if has a square factor, else ) are all multiplicative: for coprime .
Multiplicativity reduces every evaluation to prime powers: , , , , for . It also lets you evaluate divisor sums by factoring: , no enumeration required.
. Hence if for all , then .
The inversion is how you undo a divisor sum, and the identity inverts to — equivalently , which is the inclusion–exclusion you would have written by hand. Counting necklaces, primitive roots of unity, and aperiodic strings all reduce to a Möbius sum.
How many binary strings of length are primitive (not a repetition of a shorter block)? How many necklaces (strings up to rotation) do they form? (folklore)
Step 1 — every string of length is a repetition of a unique primitive block of some length . With the number of primitive strings of length , this says , and the same holds for every length: .
Step 2 — Möbius inversion: . For only contribute, with : .
Step 3 — a primitive string has distinct rotations, all primitive, so the strings fall into necklaces.
How to find it. "Count the objects of exact size " when you can easily count "objects of size dividing " is always Möbius inversion. The divisibility of by is a free sanity check.
Tempting: " is multiplicative, so ." But has three divisors, .
Multiplicativity, , is only promised for coprime , and are not coprime. The values on prime powers are independent data: , , , for . Factor completely into prime powers first, evaluate on each, then multiply. (Functions like with for all are called completely multiplicative; are not.)
For every the interval contains a prime; for there is one strictly between and .
Bertrand is a citation, not a computation: it instantly gives "there is a prime with ", which kills problems asking you to find a prime in a range or to show some product is not a perfect power. Small intervals are tight — holds only the prime , and that is the last time a Bertrand interval holds just one — so a proof that leans on two primes in must start at .
Compute .
Show the answerHide the answer
Zero. , so the identity gives — check: over .
Proofs & Why It Matters
.
Count the factor in by layers: of the numbers are divisible by , and of those are divisible again, and so on. Each multiple of is counted once in each of the first layers, so it contributes exactly — which is its valuation. Writing in base and summing the geometric series turns the sum into , the form that makes digit-sum problems immediate.
The Möbius function sums to zero over the divisors of any .
Only squarefree divisors contribute, so if has exactly distinct prime factors the sum is ; for the only divisor is and the sum is . Everything else about Möbius — the inversion formula, the totient product, inclusion–exclusion over prime divisors — is this identity applied inside a double sum.