A brief note on Factorials, Irrational Numbers, Digits and the Floor Function . Try each question before you open its answer.
The key facts Floor: ⌊ x ⌋ ≤ x < ⌊ x ⌋ + 1 \lfloor x \rfloor \le x < \lfloor x \rfloor + 1 ⌊ x ⌋ ≤ x < ⌊ x ⌋ + 1 ; ⌊ − 2.5 ⌋ = − 3 \lfloor -2.5 \rfloor = -3 ⌊ − 2.5 ⌋ = − 3 . Multiples: from 1 1 1 to n n n there are ⌊ n / d ⌋ \lfloor n/d \rfloor ⌊ n / d ⌋ multiples of d d d . Legendre: the exponent of p p p in n ! n! n ! is ∑ k ⌊ n / p k ⌋ \sum_k \lfloor n/p^k \rfloor ∑ k ⌊ n / p k ⌋ . Zeros of n ! n! n ! : the exponent of 5 5 5 . Decimals: p / q p/q p / q in lowest terms ends exactly when q = 2 i 5 j q = 2^i 5^j q = 2 i 5 j ; otherwise it repeats. Irrational: n \sqrt{n} n unless n n n is a square; log 2 3 \log_2 3 log 2 3 ; 2 + 3 \sqrt{2} + \sqrt{3} 2 + 3 . Rational roots: p / q p/q p / q with p ∣ a 0 p \mid a_0 p ∣ a 0 and q ∣ a n q \mid a_n q ∣ a n . Bases: the digits are the remainders of repeated division. Digits of N N N : ⌊ log 10 N ⌋ + 1 \lfloor \log_{10} N \rfloor + 1 ⌊ log 10 N ⌋ + 1 . Squares: last digit 0 , 1 , 4 , 5 , 6 , 9 0, 1, 4, 5, 6, 9 0 , 1 , 4 , 5 , 6 , 9 ; remainder 0 , 1 0, 1 0 , 1 on division by 4 4 4 ; 0 , 1 , 4 , 7 0, 1, 4, 7 0 , 1 , 4 , 7 on division by 9 9 9 . Cubes: remainder 0 , 1 , 8 0, 1, 8 0 , 1 , 8 on division by 9 9 9 . Practise with new numbers
A program to try The program counts the zeros of a factorial in two ways, takes the floor of a negative number and writes a number in base 3 3 3 .
Read it first. Then run it. Do the two counts of zeros agree?
1. Change n = 75 to n = 140. Add the term for 5 3 5^3 5 3 to the formula. Do they still agree?
Mistakes to avoid The floor of a negative number. Go down, not towards 0 0 0 . Only one term of Legendre's formula. Testing a fraction for an ending decimal before cancelling. Reading base digits in the wrong order. One remainder test only. Try 4 4 4 , 8 8 8 and 9 9 9 . Check yourself How many zeros end 75 ! 75! 75 ! ? Stuck? Show a hint Show the answerIs 0. 6 ‾ 0.\overline{6} 0. 6 rational? Stuck? Show a hint Show the answerIs 45 \sqrt{45} 45 rational? Stuck? Show a hint Show the answerWrite 350 350 350 in base 3 3 3 . Stuck? Show a hint Show the answerCan a square leave remainder 2 2 2 on division by 3 3 3 ? Stuck? Show a hint Show the answerSources David M. Burton, Elementary Number Theory , Chapter 6, section 6.3. Ivan Niven, Numbers: Rational and Irrational .