Deeper Arithmetic
For an odd prime : is a QR iff ; is a QR iff . Euler's criterion: .
Eleven odd primes up to have as a residue — exactly the primes that are sums of two squares (Fermat). Quadratic reciprocity then decides every by a Euclid-like descent. Olympiad use: showing an equation like has no solution for kills whole families of Diophantine equations mod a well-chosen prime.
has positive solutions in bijection with factorizations , , . For odd the count is when is a square, otherwise.
: , so solutions (the factorization gives and is excluded). For even both factors must be even, so has NO solutions — the standard parity obstruction. Every "sum/difference of squares" count is a divisor count in disguise.
jumps by at multiples of and by at multiples of , so some zero-counts () never occur. Euler: when — .
The smallest with at least trailing zeros is ( leaps from at to ). Euler plus CRT computes huge powers modulo composites: and give . Wilson's theorem handles factorials modulo primes; pairing each residue with its inverse is the proof.
Squares are and ; cubes are and ; fourth powers are . Powers of cycle with short periods mod small odd numbers. Before any heavy machinery, reduce a Diophantine equation modulo — one of them usually shows there are no solutions, or restricts them to a residue class you can then handle.
Tempting: " is a sum of two squares exactly when no prime divides ." But and .
What is true: is a sum of two squares iff every prime appears in to an even power. The argument behind it shows where the parity comes from: if divides , then and (otherwise would be a residue mod ), so divides and one can divide out. Primes are not forbidden; they must come in pairs.
Show has no integer solutions.
Show the answerHide the answer
Squares are or , so — never . Done in one line; the same idea shows no integer of the form is a sum of two squares.
Proofs & Why It Matters
For odd prime and : if is a QR, otherwise.
The multiplicative group mod is cyclic of order with generator ; write . Then , which is iff iff is even iff is a square (). Since , the value is a square root of , hence . The first supplement follows immediately: iff is even iff .
for every prime .
In the product , pair each residue with its multiplicative inverse mod . A residue is its own inverse iff iff (a polynomial of degree over a field has at most roots). All other residues pair off into products , leaving . Significance: the converse holds too ( composite for ), so Wilson characterizes primes — and the pairing trick reappears in every "product of all elements of a group" problem.
Going Deeper: Worked Problems
How many ordered pairs of positive integers satisfy ?
Step 1 — with both factors of the SAME parity; since is even, both must be even.
Step 2 — write , : with .
Step 3 — has divisors, so pairs with (no square root since is not a square).
Step 4 — each gives , : nine solutions. The parity step is where most attempts go wrong — an odd-times-even factorization of gives non-integer .
Show that is never divisible by for any positive integer .
Step 1 — the powers of mod cycle: (the order of mod is ).
Step 2 — so and — never .
Step 3 — the general principle: requires but , i.e. the order of mod is exactly — an EVEN order. Mod the order is , odd: impossible. This "order must be even" lemma settles every divisibility question.
Let be prime. Prove that satisfies . (folklore; a corollary of Wilson)
Step 1 — Wilson: .
Step 2 — split the product: the second half is , which modulo are . So .
Step 3 — is even because , so the sign is and . Example: , , and .
How to find it. Wilson's product of all residues is the square of the half-product up to the sign . This gives a constructive proof of the first supplement ( is a residue for ), which the next problem turns into sums of two squares.
Prove that every prime is a sum of two squares. (Fermat; proof via Thue's lemma)
Step 1 — by the previous example there is an integer with .
Step 2 — Thue's lemma: let , so ( is not a square). Consider the numbers with . By pigeonhole two of them agree mod : . Put , ; then , , and (if then and force , and the two pairs would coincide).
Step 3 — then , so .
Step 4 — size: , so . Example: , , : gives , too large, but gives , so and .
How to find it. " divides with small" is the goal, and a square root of gives the divisibility for free along the line . Pigeonhole finds a short vector on that line, and "divisible by and less than " pins the value.
Use the half-factorial to find an with , and then write as a sum of two squares.
Show the answerHide the answer
. Modulo : , so , and indeed . Then — Thue's lemma with gives at once.