Prime factorization
Trailing zeroes
How many zeroes does end in?
The number of zeroes at the end of a number is given by the highest power of 10 that divides the number. Moreover, considering the highest power of 2 and the highest power of 5 dividing , this number is going to be the smallest of the two. For example, the number ends with 4 zeroes (in fact, this number is ).
So, we need to find how many times the primes and appear in the decomposition of . We are going to use the following result, that we are going to prove later.
The highest power of a prime that divides a factorial is given by the
Using this result, the highest power of and dividing are given by So, the number of trailing zeroes is 24.
Let us now prove the result, for a prime and a factorial . Let us list the multiples of that are less than , the ones that bring some factor into :
Multiples of p | p | 2p | 3p | ... | p(p-1) | p^2 | ... | p(p^2-1) | p^3 | ... | n |
---|---|---|---|---|---|---|---|---|---|---|---|
1st contribution | p | p | p | ... | p | p | ... | p | p | ... | |
2nd contribution | ... | p | ... | p | ... | ||||||
3rd contribution | ... | ... | p | ... | |||||||
4th contribution | ... | ... | ... |
The highest power of dividing is the number of occurrences of in this table. Let us now count this number, counting row by row. In the first row, there is one for every multiple of that is smaller than or equal to . This means that there is exactly of them. Similarly, in the second column all multiples of that are smaller than or equal than appear, so there is of them. Keeping going, in the $i$-th row there are going to be occurrences of , and the formula follows just taking the sum.
A fixed number of divisors
What is the smallest natural number which has exactly 77 divisors?
The number of divisors of a natural number is given by the product . This is because every divisor will be of the form where every satisfies . So, for every we have choices, and the choices are independent, and hence the formula follows.
Now, we want to find the smallest number such that . Let us now analyze all possible decompositions of . The only two possible options are and alone itself. Notice that we do not consider ones in the decomposition because we would have a factor equal to , that means .
In the first case, we get
So, our number will be of the form for prime numbers. How can we choose them so that is as small as possible? Of course, we need to pick and as small as possible, that means, and . We are left with two possibilities now, and , and clearly the second is smaller.
In the second case, the number is of the form . To make it as small as possible, we need to pick , so that . This number is way bigger than the numbers we found before (in fact, it has more than three times the digits).
Concluding, having exhausted all possibilities, the smallest number with 77 divisors is .
The locker game
The students of a local high school enjoy the following extra-curricular activity. After the end of the day, all 100 students go in front of their closed lockers, numbered 1 to 100. The headmaster then proceeds to blow a whistle 100 times. At the first sound, all students open their lockers. At the second, the students standing by even lockers close them. The game continues in a similar manner -- at the -th step students in front of lockers divisible by toggle them.
Which lockers are open at the end of the game?
Instead of focusing in what happens at a specific blow, let us choose a different strategy: we pick a lock, let's say the -th, and let's see how many times it is toggled throughout the 100 blows. The lock will be open in the end if is has been toggled an odd number of times. Now, the lock is toggled at the -th blow whenever is a divisor or , so it is toggled once for every divisor of . So, the -th lock will be open in the end exactly if has an odd numbers of divisors.
We can now focus on the question: what are the numbers with an odd number of divisors? Looking at the formula from the previous exercise, the number of divisors of is given by the product . This product can be odd only if every factor is odd too, that in turns gives us that every has to be even. But this means that the number has to be a square! Hence, the locks that are going to be open at the end are just the squares, namely