Primes
A prime is an integer whose only positive divisors are and ; an integer that is not prime is composite. There are infinitely many primes: given any finite list , the number has a prime factor, and it is none of the (each leaves remainder ).
Euclid's argument does not say is prime; it says has a NEW prime factor, which is all that is needed — no finite list can be complete. To test whether is prime, trial-divide by the primes up to and no further: if with , then , so the smaller factor is at most . A composite number cannot hide both of its factors above its square root.
To list the primes up to , write out and strike the proper multiples of , then of , and . Then stop: , so every composite number up to has a prime factor of at most and is already struck. What survives are the primes .
If with , then (as ). So only the primes need testing. is odd, its digit sum is not a multiple of , and it does not end in or ; and ; but . Composite.
Is prime? Here , so test the primes up to . The small ones fail at a glance; , , ; and then . The factor appears only at — stopping the search early at would have wrongly declared prime.
Believing Euclid's number is itself prime. is prime, but is not. The proof only needs its prime factors to be new, and and are. (And is not prime: allowing it would wreck the uniqueness of factorizations, since .)
Is prime?
Show the answerHide the answer
Since , test the primes up to : is odd, has digit sum , does not end in or ; , , . No prime up to divides it, so it is prime.
The Fundamental Theorem of Arithmetic
Every integer is a product of primes, and the factorization is unique up to order: . The exponents answer most questions about : the number of divisors is ; is a perfect square exactly when every is even.
Uniqueness is the deep half. Existence is easy (keep splitting); uniqueness needs Euclid's lemma — if a prime divides a product, it divides a factor — which in turn rests on Bézout. In number systems where uniqueness fails, like where , almost every familiar argument breaks. Prime factorizations are the coordinates of the integers: the divisor count formula holds because a divisor of is exactly a choice of exponent for each prime, with no other primes allowed.
Factor . Divide by the smallest prime as long as it goes in: uses four s; uses two s; and . So . Working upward from the smallest prime guarantees nothing is missed: once the s are gone, no later quotient is even.
. By uniqueness, a divisor of can contain no prime but and , and no more of each than has, so it is with and . That is choices times choices: divisors, laid out as a grid in which moving right multiplies by and moving up multiplies by .
Find the smallest positive with a perfect square. Factor: . A square needs every exponent even; already is, needs one more , and needs one more . So , and indeed . Any smaller leaves an odd exponent somewhere.
Multiplying the exponents instead of the exponents plus one. For that gives , but the grid above has entries: the exponent is a legitimate choice for each prime (it is how , , , , and arise), so each prime offers options.
How many positive divisors of are perfect squares?
Show the answerHide the answer
. A square divisor needs even: , , . That is square divisors (from up to itself).
Factorials and Legendre's Formula
The exponent of a prime in is , a sum that stops once . Each term counts the multiples of a power of up to .
The factors of are , and appears in once for every factor in every one of them. Multiples of contribute at least one; multiples of contribute a second, counted in the second term; multiples of a third, and so on. So the sum counts each exactly as many times as divides it. The picture below counts the same dots two ways, by columns and by rows.
Stack one dot above each for each factor in . Counting by rows: the bottom row has a dot at every even , of them; the second row at the multiples of , ; the third at the multiples of , . Total , so exactly divides .
Each trailing zero is a factor , and has far more s than s, so the s decide. Exponent of in : (and stops the sum). So ends in zeros.
Find the largest with . Since , both primes limit . Exponent of in : , so and . Exponent of : , so . The tighter bound wins: . Note that the scarcer prime here is , because needs two of them at a time.
Stopping after the first term. counts only once each, but each of them contains ; the second term adds the missing . Counting the s instead of the s is the other slip — the answer is the smaller count, never the larger.
How many zeros end ?
Show the answerHide the answer
Count the factors of : (and ). The s are more plentiful, so there are zeros.
Why It Works
Lemma: if is prime and , then or . Proof: if then , so by Bézout for some integers . Multiply by : , and divides both terms, so . Uniqueness of factorization follows: if , then divides the right side, hence (by the lemma, repeatedly) divides some , hence equals it; cancel and repeat. The lemma is exactly what fails in , where divides but neither factor.
Write for the number of times divides ; the exponent of in is , the column count in the figure. Now equals the number of with , so the sum counts pairs with and . Count the same pairs row by row: for fixed there are multiples of up to . Switching the order of a double count is one of the most useful moves in the subject.