Sum of Binary Trailing Zeros

math

Table of Contents

While working through a project euler problem I noticed an interesting pattern:

When writing down the numbers from sum_of_binary_trailing_zeros_8fc2434f4c4785d9b41c1b65bb44608802ca451e.svg to sum_of_binary_trailing_zeros_497f8ee5c66209d02425c9dbbfca25b70dbac458.svg the total number of trailing zeros (called sum_of_binary_trailing_zeros_7281331ffaac9b336fd47d5b97c07b9f629f8cbd.svg for the rest of this post) is equal to sum_of_binary_trailing_zeros_34abd15717132a283391ead9083819ca3dc9e6de.svg where sum_of_binary_trailing_zeros_50c684d8e17fe0ccd0bce75f9e8857c2a9bea349.svg is the number of ones in the binary representation of sum_of_binary_trailing_zeros_497f8ee5c66209d02425c9dbbfca25b70dbac458.svg .

It took me a while to understand why this is true and even longer to formulate a somewhat elegant proof. What follows is my best try so far.

Example

  1. 0001
  2. 001 0
  3. 0011
  4. 01 00
  5. 0101
  6. 011 0
  7. 0111
  8. 1 000
  9. 1001
  10. 101 0

In the first sum_of_binary_trailing_zeros_45bc77655817ecf7bcefbdeb4d8810fd5b4b1f19.svg numbers there are sum_of_binary_trailing_zeros_0a3a9d3c5fa642921207e45061e8065f15b9aacc.svg trailing zeros. sum_of_binary_trailing_zeros_e2e132e598403caa760dad1fce1c05d669d5d773.svg , so the equation holds.

Proof

A binary number has at least sum_of_binary_trailing_zeros_2cfc0243a3ad62b4dfdb5ebd36f9ff70a404e8ab.svg trailing zeros sum_of_binary_trailing_zeros_8e02274ad761a6515555046e1703e175873c81d0.svg it is a multiple of sum_of_binary_trailing_zeros_dbc5dcc892de4df1a774c08d23b3f04736cc4b70.svg .

In the example above there are sum_of_binary_trailing_zeros_7aa6f60a18571998df064a963d4a461e42000e4a.svg numbers with at least one trailing zero, sum_of_binary_trailing_zeros_95c5edfab36a01132ea525f7c72e518a9513f238.svg numbers with at least two trailing zeros, and sum_of_binary_trailing_zeros_9065f493357496907dbd592ce333283aa8144da4.svg numbers with at least three trailing zeros.

For arbitrary sum_of_binary_trailing_zeros_497f8ee5c66209d02425c9dbbfca25b70dbac458.svg this can be written as

sum_of_binary_trailing_zeros_c3c91ce77fe934654ae3668785415f87d9c48aa3.svg

which is not really an infinite sum because after a while ( sum_of_binary_trailing_zeros_5cda1a618c9b9dbb8dc9d87985026ed9fef02a41.svg ) all the remaining summands are zero.

sum_of_binary_trailing_zeros_497f8ee5c66209d02425c9dbbfca25b70dbac458.svg can be written (binary notation) as sum_of_binary_trailing_zeros_d999bb437fad0b000dcf4a945a14fdae47f23524.svg with sum_of_binary_trailing_zeros_649b558ace0cb104921cc924b1f7cd6cbc01da7b.svg .

sum_of_binary_trailing_zeros_044e8fd1ccd38afc08bcc1a20b7ccf4ad6eb7905.svg

The division by sum_of_binary_trailing_zeros_bbe6cba6f3d43ce34cb8506ef9b69852d058ebf6.svg can be understood as moving the "decimal" point in the binary representation of sum_of_binary_trailing_zeros_497f8ee5c66209d02425c9dbbfca25b70dbac458.svg sum_of_binary_trailing_zeros_3fe1906f97f7ababb35bc167a45074b8443bcca2.svg places to the left. sum_of_binary_trailing_zeros_d15c2818a43a27a3b7b87ec3ff8c73da869242c9.svg is equivalent to cutting off everything after the "decimal" point of sum_of_binary_trailing_zeros_a5e295d1d7f1656701a081d7929acf38cf912697.svg (independent of the base).

sum_of_binary_trailing_zeros_7df0a88f87e7ba341b0c10b6d77ebf091e950e3f.svg

How does this apply to the equation from before? First I'll introduce a simple indicator function that will make the next steps of the proof a little bit easier to follow:

sum_of_binary_trailing_zeros_70bb387767bca3a71cb48428f08b4f8a32961bda.svg

What this allows us to do is to rewrite sum_of_binary_trailing_zeros_fbde51087b6acdb5f8992cc386d737b9739ed2fd.svg by multiplying each sum_of_binary_trailing_zeros_959cec3aa3cde97e467c6f52f2921e92357d6563.svg with sum_of_binary_trailing_zeros_f91db80de28684ff0d549259a5da5c06048c9b50.svg so that it removed from the sum if sum_of_binary_trailing_zeros_de0ff6637ad1a3284a17fc873bbea67226285aca.svg (as part of the numbers behind the "decimal" point that are cut of).

sum_of_binary_trailing_zeros_5be8c06a0450f0f63a258bb59a6578486f277eef.svg

If the step from sum_of_binary_trailing_zeros_35436757fe1f8b032dda44c078dc891f73d0b03b.svg to sum_of_binary_trailing_zeros_89390a6db763a229ce1624d076150399d153a9f2.svg is not obvious, think about what happens when sum_of_binary_trailing_zeros_8fc2434f4c4785d9b41c1b65bb44608802ca451e.svg is added to a binary number that is made up entirely of ones: sum_of_binary_trailing_zeros_4fd1293ab098fa230615ae5cc3f7ec577d982e72.svg .

Trailing Zeros of sum_of_binary_trailing_zeros_ba21eb32b91573e430eb83b2a3cf02d5eaeb4271.svg

Let sum_of_binary_trailing_zeros_090cdbd5d886946fd6e40c690d6ed6fd056b1232.svg be the number of trailing zeros when sum_of_binary_trailing_zeros_497f8ee5c66209d02425c9dbbfca25b70dbac458.svg is written in binary.

sum_of_binary_trailing_zeros_e22e01c28536184b45f660e51576d44b9b0125a2.svg (see Binary Trailing Zeros of Products ), so sum_of_binary_trailing_zeros_19c6664e8b9da908c3af58b3d57c45c5a3405d08.svg .

Example: sum_of_binary_trailing_zeros_8e0075290282fa750d0084a0e2368ee9c28ccf54.svg has sum_of_binary_trailing_zeros_16f12cf7a2c058772d3954ef27f3bbcbc3a29e59.svg trailing zeros.


If you have an idea how this page could be improved or a comment send me a mail.