Big, bad, binary

( 2 3 ) ! = 4032 0 10 = 1001 1101 1000 000 0 2 . (2^3)! = 40320_{10} = 1001\:1101\:1000\:0000_2.

The factorial shown above has seven trailing zeros .

How many trailing zeroes does the number ( 2 16 ) ! (2^{16})! have in binary notation?


The answer is 65535.

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.

3 solutions

Arjen Vreugdenhil
Jan 21, 2016

Counting trailing zeroes is equal to counting powers of the base-- in this case, powers of 2.

In n ! n! , each even number n \leq n contributes a power of 2.

Each multiple of four contributes another power of 2.

Each multiple of eight contributes another power of 2.

And so on. Thus the number of factors of 2 in n ! n! is equal to ( multiples of 2 1 , n ) + + ( multiples of 2 i , n ) + = n 2 1 + + n 2 i + , (\text{multiples of}\ 2^1,\ \leq n) + \cdots + (\text{multiples of}\ 2^i,\ \leq n) + \cdots \\ = \left\lfloor\frac n{2^1}\right\rfloor + \cdots + \left\lfloor\frac n{2^i}\right\rfloor + \cdots, where 2 i 2^i can be limited to be less than or equal to n n . The calculation becomes particularly easy when n = 2 k n = 2^k , because the argument of the floor function \lfloor\cdot\rfloor is a whole number in every instance:

factors of 2 in ( 2 k ) ! = 2 k 2 1 + + 2 k 2 i + + 2 k 2 k = 2 k 1 + + 2 0 = 2 k 1. \text{factors of 2 in}\ (2^k)! = \frac{2^k}{2^1} + \cdots + \frac{2^k}{2^i} + \cdots + \frac{2^k}{2^k} \\ = 2^{k-1} + \cdots + 2^0 = 2^k-1.

Substitute k = 16 k = 16 and we find that there are 2 16 1 = 65535 2^{16}-1 = \boxed{65535} factors of 2 in ( 2 16 ) ! (2^{16})! , and therefore 65335 trailing zeroes in its binary representation.

Jon Haussmann
Jan 22, 2016

Let n n be a positive integer, let p p be a prime, and let s s be the sum of the digits in n n when expressed in base p p . Then the number of factors of p p in n ! n! is given by n s p 1 . \frac{n - s}{p - 1}.

For n = 2 16 n = 2^{16} and p = 2 p = 2 , s = 1 s = 1 , so the number of factors of 2 in ( 2 16 ) ! (2^{16})! is simply 2 16 1 = 65535 2^{16} - 1 = 65535 .

Prove your claim :)

Arjen Vreugdenhil - 5 years, 4 months ago

Log in to reply

It's not hard to prove. Just take n n , express it in base p p , and apply your formula involving the floors. It works out nicely, and I leave the details to the interested reader.

Jon Haussmann - 5 years, 4 months ago
Arulx Z
Jan 22, 2016

As Arjen said, we just need to count the powers of 2 in 2 16 2^{16} . We can express this as

n = 1 16 2 16 2 n = 2 16 n = 1 16 1 2 n \sum _{ n=1 }^{ 16 }{ \frac { { 2 }^{ 16 } }{ { 2 }^{ n } } } ={ 2 }^{ 16 }\sum _{ n=1 }^{ 16 }{ \frac { 1 }{ { 2 }^{ n } } }

This is because every power of 2 less than or equal to 16 is a divisor of 2 16 2^{16} . On simplifying the GP, we get

2 16 ( 1 1 2 16 ) = 2 16 1 = 65535 { 2 }^{ 16 }\left( 1-\frac { 1 }{ { 2 }^{ 16 } } \right) ={ 2 }^{ 16 }-1=65535

In fact, with a little thought, it can also be proved that for any positive integral n n , ( 2 n ) ! 2 { \left( { 2 }^{ n } \right) ! }_{ 2 } has 2 n 1 2^n - 1 trailing zeroes in base 2.

You mean 2 n 1 2^n - 1 zeroes?

Arjen Vreugdenhil - 5 years, 4 months ago

Log in to reply

Oh yes. Thanks a ton for the correction. I have modified my answer.

Arulx Z - 5 years, 4 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...