Heyyyyyy, sexy lady!

Before December 2014, Youtube used a 32-bit signed integer to record down the number of Youtube views of a particular video.

What is the most number of views that would be displayed?

Image credit: Flickr Syed Ikhwan
2 31 2^{31} 2 32 1 2 ^ {32} - 1 2 31 1 2 ^ { 31} - 1 2 32 2^{32}

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.

4 solutions

Discussions for this problem are now closed

Tawfiq Hamid
May 2, 2015

A 32 bit integer could take values upto 2^32 - 1. In practice Youtube were using a signed integer which means 1 bit was used to dictate whether the number was positive or negative, hence the value was only stored by 31 bits.

Therefore in practice only 2^31 -1 views were counted before the view count overflowed.

@Tawfiq Hamid , we really liked your comment, and have converted it into a solution. If you subscribe to this solution, you will receive notifications about future comments.

Brilliant Mathematics Staff - 6 years, 1 month ago
Oussama Boussif
Dec 7, 2014

One Can use summation to solve This one, we have in base 2: n m a x = 1111 11 n_{max}=1111\dots11 32 times

So in base 10 it would be: n m a x = n = 0 31 2 n n_{max}= \displaystyle \sum_{n=0}^{31} 2^{n}

wich is: n m a x = 2 31 1 n_{max}=2^{31}-1

Jake Lai
Dec 7, 2014

Since the smallest number of views is 0 0 and the views include all 2 32 2^{32} positive integers after 0 0 , the maximum number of views would be 2 32 1 2^{32}-1 .

Related:

There is 1 type of people. Those who start listing from 1 and those who don't.

Calvin Lin Staff - 6 years, 6 months ago

But is it broken when it lists the maximum number of views, or when it can't list the correct number of views?

Christopher Patridge - 6 years, 6 months ago

why not 2*32 +1

Ayaz Faqir - 6 years, 6 months ago
Vishnu Bhagyanath
Dec 10, 2014

Its 2^31 -1, not 2^32 -1

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...