3 ms·
It's probably a webdesigner-thing to think of 960 as a nice round number, but that's the first thing I thought upon reading that.
by kilian 16y ago
It's probably a webdesigner-thing to think of 960 as a nice round number, but that's the first thing I thought upon reading that.
- zbanks 16y agoSimilar thing happens all the time with powers of 2...
- petercooper 16y agoI confess: I thought "960 Times" was a newspaper fixed width stylesheet template of some sort at first.
- deleted 16y ago[deleted]
- SebMortelmans 16y agoHaha, I was thinking exactly the same thing :) Professional handicap I guess.
- sliverstorm 16y agoIt's a relatively common number in computing. It's similar to how numbers such as 512, 256 and 1024 are intimately familiar to me.
- Raphael 16y agoIt's not a power of 2 (although it is 512 + 256 + 128 + 64). Chess960 is the most popular variant of Chess, having 960 possible board layouts. There is the famous CSS framework, 960 Grid System. And it happens to be in the family of common display dimension, being twice the height of standard definition, 480, like the new iPhone and iPod, as well as half the width of an HD television (1080), 1920.
- Natsu 16y ago> It's not a power of 2 (although it is 512 + 256 + 128 + 64). Well, if that counts as "round" then I have to remind you that any integer can be written as a unique sum of various powers of two (or ten, or eight, or ...). That said, being able to quickly convert an arbitrary number into that form has proven useful more than a few times. But I admit that I never realized that playing a very old, free game called "Binary Blitz" would turn out to be quite so useful to me.
- rudin 16y agoYeah but it MUCH rarer that an integer can be written in consecutive powers of 2.
- Natsu 16y agoDefine "rarer"? There's an infinite number of integers that can be written in consecutive powers of 2. So in some sense, there's exactly as many of those as there are of integers! For fun, see if you can write a bijection between the integers and the "consecutive ones". Hint: realize that a "consecutive power of 2" number can be split into two numbers: a number of consecutive ones greater than zero followed by a number of consecutive zeroes (you can have zero of these), then think about diagonalization. That said, I suppose you could define some sort of "density" of numbers with consecutive ones in a fixed-size range. Say that you want to know how many of them are between 0 and 2^x (i.e. how many such numbers are x bits long). Well, you get sum(1..x-1) different consecutive numbers (for 2^8, there are 7 ways to have a pair of ones, 6 ways to have 3 consecutive ones, as you can see by imagining sliding the pair or triplet: 11100000, 01110000, 00111000, ... 00000111) and there are 2^x possibilities total. Add x-1 + x-2 + ... + 2 + 1 to itself backwards and you get: (x-1 + 1) + (x-2 + 2) + ... where there are x-1 terms in the series, which allows us to rewrite it as x * (x-1). This is double the original sum (because we added it to itself), so divide it by two and we've shown that sum(1..x-1) == (x^2 - x)/2. Now, divide that by 2^x and simplify to get D(x) = (x^2 - x)/2^(x+1) for the fraction of x-bit numbers that are consecutive powers of two. It doesn't take much analysis to see that it is decreasing when x grows after increasing initially: Density of consecutive ones in 1-bit numbers = 0 Density of consecutive ones in 2-bit numbers = 0.25 Density of consecutive ones in 3-bit numbers = 0.375 Density of consecutive ones in 4-bit numbers = 0.375 Density of consecutive ones in 5-bit numbers = 0.3125 Density of consecutive ones in 6-bit numbers = 0.234375 Density of consecutive ones in 7-bit numbers = 0.1640625 Density of consecutive ones in 8-bit numbers = 0.109375 In short, "much rarer" depends on how big a number we're dealing with and the measure won't work for infinitely large numbers, because there are a countably infinite number of consecutive-power numbers, so they can be put into 1-to-1 correspondence with the integers, even though our D(x) decreases. TL;DR: Math is crazy and relies on precise definitions. Be wary of intuition.