3 ms·
> If I ask you to calculate 8x8x8x8x8x8x8x8x8, your head will explode (it’s 134,217,728). If only this question had asked for 8x8x8x8x8x8x8x8 instead... that's
by schoen 9y ago
> If I ask you to calculate 8x8x8x8x8x8x8x8x8, your head will explode (it’s 134,217,728).
If only this question had asked for 8x8x8x8x8x8x8x8 instead... that's (2⁸)³=2²⁴=16777216, which many programmers would know. :-) (for example because it's the number of IP address in a /8 network, or the number of colors in a 24-bit color space, or the number of bytes addressable on by the Intel 286)
Edited with typographical correction pointed out a by commenter below (thanks!).
- JimboOmega 9y agoIt's pretty easy to estimate if you know - as I think most of us do - that 2^10 = 1024 ~= 1000 8^9 = 2^27, so 1000 * 1000 * 2^7 = 128,000,000.
- wickawic 9y agoFor anyone who doesn't know the whole trick: 2^10 ~= 1_000 (2.5% error) 2^20 ~= 1_000_000 (4% error) 2^30 ~= 1_000_000_000 (7% error) Because of exponentials, each power of 5 between is about 1/30 of the way to the next power of 10 (2^5 = 32, 2^15=32_768, etc). With this framework you have good anchors for all 2^(5k), which means you only ever have to divide/multiply by at most 8 to get a good approximation for any power of two. Now you can impress your coworkers with your amazing ability to fudge powers of two in your head.
- iainmerrick 9y agoHuh, that’s a little different from the way I do it! I don’t do it in fives, I just remember that 2^10 ~= 1000, then memorize the powers from 0 to 9. Sounds like GP does the same. (Anyone else play the old DC Heroes RPG?)
- deleted 9y ago[deleted]
- dwringer 9y agoA minor nitpick, but reading it threw me for a brief loop: 2⁸2³=2⁸⁺³=2¹¹, while 8x8x8x8x8x8x8x8 is (2³)⁸=2³*⁸=2²⁴
- schoen 9y agoEdited, thanks for noticing that.
- YZF 9y agoA slightly different way of thinking about that 24: log2(8)=3 ... 3*8 = 24