Master the factorial

Find the 64th digit from last of 258 ! 258! .

Notation: ! ! denotes the factorial notation . For example: 8 ! = 1 × 2 × 3 × 4 × 5 × 6 × 7 × 8 8! = 1\times 2 \times 3 \times 4 \times 5 \times 6 \times 7 \times 8


The answer is 6.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Zico Quintina
Jun 22, 2018

The number of trailing zeroes in any number is the same as the exponent of the largest power of 10 10 that divides the number; this in turn means that the number of trailing zeroes in any number is the same as the exponent of the either the largest power of 2 2 or the largest power of 5 5 (whichever is lower) that divides the number.

For n 2 n \ge 2 , n ! \ n! has a larger of number of multiples of 2 2 than multiples of 5 5 , which means that the number of trailing zeroes in n ! n! is the same as the exponent of the largest power of 5 5 which divides n ! n! . We can calculate this power using the formula

n 5 + n 5 2 + n 5 3 + . . . . \left\lfloor \dfrac{n}{5} \right\rfloor + \left\lfloor \dfrac{n}{5^2} \right\rfloor + \left\lfloor \dfrac{n}{5^3} \right\rfloor + \ ....

In our case we find that the largest power of 5 5 which divides 258 ! 258! is

258 5 + 258 5 2 + 258 5 3 = 51 + 10 + 2 = 63 \left\lfloor \dfrac{258}{5} \right\rfloor + \left\lfloor \dfrac{258}{5^2} \right\rfloor + \left\lfloor \dfrac{258}{5^3} \right\rfloor = 51 + 10 + 2 = 63

so 258 ! 258! has 63 63 trailing zeroes. So the digit we're seeking is the first non-zero digit to the left of the trailing zeroes.

Consider the product of four consecutive natural numbers between multiples of 5 5 . These could either be of the form ( 10 k + 1 ) ( 10 k + 2 ) ( 10 k + 3 ) ( 10 k + 4 ) (10k + 1)(10k + 2)(10k + 3)(10k + 4) or ( 10 k + 6 ) ( 10 k + 7 ) ( 10 k + 8 ) ( 10 k + 9 ) (10k + 6)(10k + 7)(10k + 8)(10k + 9) . Then

( 10 k + 1 ) ( 10 k + 2 ) ( 10 k + 3 ) ( 10 k + 4 ) 1 2 3 4 ( m o d 10 ) 24 ( m o d 10 ) 4 ( m o d 10 ) \begin{array}{rl} (10k + 1)(10k + 2)(10k + 3)(10k + 4) &\equiv 1 \cdot 2 \cdot 3 \cdot 4 \pmod{10} \\ \\ &\equiv 24 \pmod{10} \\ \\ &\equiv 4 \pmod{10} \end{array}

and similarly

( 10 k + 6 ) ( 10 k + 7 ) ( 10 k + 8 ) ( 10 k + 9 ) 6 7 8 9 ( m o d 10 ) - 4 - 3 - 2 - 1 ( m o d 10 ) 24 ( m o d 10 ) 4 ( m o d 10 ) \begin{array}{rl} (10k + 6)(10k + 7)(10k + 8)(10k + 9) &\equiv 6 \cdot 7 \cdot 8 \cdot 9 \pmod{10} \\ \\ &\equiv \text{-}4 \cdot \text{-}3 \cdot \text{-}2 \cdot \text{-}1 \pmod{10} \\ \\ &\equiv 24 \pmod{10} \\ \\ &\equiv 4 \pmod{10} \end{array}

Any number congruent to 4 m o d 10 4 \bmod {10} can be written as 2 m 2m , where m m is congruent to either 2 m o d 10 2 \bmod {10} or 7 m o d 10 7 \bmod {10} ; however, our products above contain exactly two even factors so if we were to factor out a single 2 2 the remaining factor would have to be congruent to 2 m o d 10 2 \bmod {10} .

Thus any product of five consecutive natural numbers ending in a multiple of 5 5 can be written as

( 10 k + 1 ) ( 10 k + 2 ) ( 10 k + 3 ) ( 10 k + 4 ) ( 10 k + 5 ) = ( 10 k + 5 ) 2 a (10k + 1)(10k + 2)(10k + 3)(10k + 4)(10 k + 5) = (10k + 5) \cdot 2 \cdot a

or

( 10 k + 6 ) ( 10 k + 7 ) ( 10 k + 8 ) ( 10 k + 9 ) ( 10 k + 10 ) = ( 10 k + 10 ) 2 b (10k + 6)(10k + 7)(10k + 8)(10k + 9)(10 k + 10) = (10k + 10) \cdot 2 \cdot b

where a a and b b are both congruent to 2 m o d 10 2 \bmod{10} .

Now 258 ! 258! can be split into 51 51 blocks of five consecutive natural numbers, with three remaining factors:

258 ! = ( 1 2 3 4 5 ) ( 6 7 8 9 10 ) ( 11 12 13 14 15 ) ( 16 17 18 19 20 ) . . . . 256 257 258 = ( 5 2 a ) ( 10 2 b ) ( 15 2 c ) ( 20 2 d ) . . . . 256 257 258 = ( 5 10 15 20 . . . . ) ( 2 2 2 2 . . . . ) ( a b c d . . . . ) 256 257 258 = 5 51 ( 1 2 3 4 . . . . ) 2 51 ( a b c d . . . . ) 256 257 258 = 1 0 51 51 ! ( a b c d . . . . ) 256 257 258 \begin{array}{rl} 258! &= (1 \cdot 2 \cdot 3 \cdot 4 \cdot 5) \cdot (6 \cdot 7 \cdot 8 \cdot 9 \cdot 10) \cdot (11 \cdot 12 \cdot 13 \cdot 14 \cdot 15) \cdot (16 \cdot 17 \cdot 18 \cdot 19 \cdot 20) \cdot \ .... \ \cdot 256 \cdot 257 \cdot 258 \\ \\ &= (5 \cdot 2 \cdot a) \cdot (10 \cdot 2 \cdot b) \cdot (15 \cdot 2 \cdot c) \cdot (20 \cdot 2 \cdot d) \cdot \ .... \ \cdot 256 \cdot 257 \cdot 258 \\ \\ &= (5 \cdot 10 \cdot 15 \cdot 20 \ \cdot \ ....) \cdot (2 \cdot 2 \cdot 2 \cdot 2 \ \cdot \ ....) \cdot (a \cdot b \cdot c \cdot d \ \cdot \ ....) \cdot 256 \cdot 257 \cdot 258 \\ \\ &= 5^{51} \cdot (1 \cdot 2 \cdot 3 \cdot 4 \cdot \ ....) \cdot 2^{51} \cdot (a \cdot b \cdot c \cdot d \ \cdot \ ....) \cdot 256 \cdot 257 \cdot 258 \\ \\ &= 10^{51} \cdot 51! \cdot (a \cdot b \cdot c \cdot d \ \cdot \ ....) \cdot 256 \cdot 257 \cdot 258 \end{array}

We know that the factor ( a b c d . . . . ) (a \cdot b \cdot c \cdot d \cdot ....) above will be congruent to 2 51 m o d 10 2^{51} \bmod{10} and we can calculate that 256 257 258 6 7 8 336 6 m o d 10 256 \cdot 257 \cdot 258 \equiv 6 \cdot 7 \cdot 8 \equiv 336 \equiv 6 \bmod{10} .

Thus we can write

258 ! 1 0 51 ( 51 ! 2 51 6 ) ( m o d 10 ) \dfrac{258!}{10^{51}} \equiv \left( 51! \cdot 2^{51} \cdot 6 \right) \pmod{10}

If we repeat the above process for 51 ! 51! , we get that

51 ! 1 0 10 ( 10 ! 2 10 1 ) ( m o d 10 ) \dfrac{51!}{10^{10}} \equiv \left( 10! \cdot 2^{10} \cdot 1 \right) \pmod{10}

and

10 ! 1 0 2 ( 2 ! 2 2 ) ( m o d 10 ) \dfrac{10!}{10^2} \equiv \left( 2! \cdot 2^{2} \right) \pmod{10}

Combining these we find that

258 ! 1 0 63 ( 2 ! 2 2 2 10 2 51 6 ) ( m o d 10 ) ( 2 64 6 ) ( m o d 10 ) \begin{array}{rl} \dfrac{258!}{10^{63}} &\equiv \left( 2! \cdot 2^2 \cdot 2^{10} \cdot 2^{51} \cdot 6 \right) \pmod{10} \\ &\equiv \left( 2^{64} \cdot 6 \right) \pmod{10} \end{array}

Finally, using the facts that 2 4 6 m o d 10 2^4 \equiv 6 \bmod{10} and 6 n 6 m o d 10 6^n \equiv 6 \bmod{10} we get

258 ! 1 0 63 ( ( 2 4 ) 16 6 ) ( m o d 10 ) 6 17 ( m o d 10 ) 6 ( m o d 10 ) \begin{array}{rl} \dfrac{258!}{10^{63}} &\equiv \left( (2^4)^{16} \cdot 6 \right) \pmod{10} \\ \\ &\equiv 6^{17} \pmod{10} \\ \\ &\equiv 6 \pmod{10} \end{array}

so 258 ! 258! will have 63 63 trailing zeroes, and the 64 64 th digit will be 6 \boxed{6}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...