Here's all you really need to know about logs when estimating in your head:
The number of digits minus one is the magnitude (integer). Then add the leading digit like so:
1x = ^0.0
2x = ^0.3 (actually ^0.301...)
pi = ^0.5 (actually ^0.497...)
5x = ^0.7 (actually ^0.699...)
Between these, you can interpolate linearly and it's fine for estimating. Also 3x is close enough to pi to also be considered ^0.5.
In fact, if all you're doing is estimating, you don't even really need to know the above log table. Just use the first digit of the original number as the first digit past the decimal. So like 6000 would be ^3.6 (whereas it's actually ^3.78). It's "wrong" but not that far off if you're using logarithmetic for napkin math.
And this is also the basis of the fast inverse square root algorithm. Floating point numbers are just linear interpolations between octaves.
dhosek · 3h ago
The pi = ^0.5 bit reminds me of a college physics professor who was fond of using the shortcut π²=10.
madcaptenor · 3h ago
This is wrong, π² = g, the acceleration due to gravity.
thomasahle · 10h ago
What is this ^notation?
Looks like 5x=^0.699 means log_10(5)=0.699.
saulpw · 9h ago
It's magnitude notation. ^X is short for 10^X.
xeonmc · 10h ago
5 = 10^0.699
thechao · 11h ago
I don't know about powers-of-10; but, you can use something similar to bootstrap logs-in-your-head.
So, 2^10=1024. That means log10(2)~3/10=0.3. By log laws: 1 - .3 = 0.7 ~ log10(5).
Similarly, log10(3)*9 ~ 4 + log10(2); so, log10(3) ~ .477.
Other prime numbers use similar "easy power rules".
Now, what's log10(80)? It's .3*3 + 1 ~ 1.9. (The real value is 1.903...).
The log10(75) ~ .7*2+.477 = 1.877 (the real answer is 1.875...).
Just knowing some basic "small prime" logs lets you rapidly calculate logs in your head.
madcaptenor · 10h ago
For log(3) I prefer the "musical" approximation 2^19 ~ 3^12. This is a "musical" fact because it translates into 2^(7/12) ~ 3/2 - that is, seven semitones make a perfect fifth). Together with log(2) ~ 3/10 that gives log(3) ~ 19/40.
Also easy to remember: 7^4 = 2401 ~ 2400. log(2400) = log(3) + 3 log(2) + 2 ~ 19/40 + 3 * 12/40 + 2 = 135/40, so you get log(7) ~ 135/160 = 27/32 = 0.84375.
thechao · 7h ago
These are both great! I learned most of these old tricks from my dad & grandfather.
xeonmc · 11h ago
Protip: since halving and doubling are the same logarithmic distance on either sides of unity, and the logarithmic distance of 2.0 to 5.0 is just a tiny bit larger than that of doubling, this means that you can roughly eyeball the infra-decade fraction by cutting them into thirds
(I see that someone already mentioned fast inverse square root algorithm is related to this, which is famously used by John Carmack which is one of my hero who led me into tech industry, despite I didn't end up in gaming industry)
briian · 10h ago
So much of economics maths/stats is built on this one little trick.
It's still pretty cool to me that A this works and B it can be used to do so much.
nicoburns · 6h ago
deleted
gus_massa · 10h ago
Typo near the top, in case someone knows the author:
> log(100)≤log(N)<log(100)
There is a missing 0 in the last log. It should be
The number of digits minus one is the magnitude (integer). Then add the leading digit like so:
1x = ^0.0
2x = ^0.3 (actually ^0.301...)
pi = ^0.5 (actually ^0.497...)
5x = ^0.7 (actually ^0.699...)
Between these, you can interpolate linearly and it's fine for estimating. Also 3x is close enough to pi to also be considered ^0.5.
In fact, if all you're doing is estimating, you don't even really need to know the above log table. Just use the first digit of the original number as the first digit past the decimal. So like 6000 would be ^3.6 (whereas it's actually ^3.78). It's "wrong" but not that far off if you're using logarithmetic for napkin math.
So you only need to remember:
Put the effort into remembering a 3 digit log for 7 instead?
Or keep the same precision with ...
Log 2 is all you need?Or even ...
VERY accurate, but that's getting to be too much.Looks like 5x=^0.699 means log_10(5)=0.699.
So, 2^10=1024. That means log10(2)~3/10=0.3. By log laws: 1 - .3 = 0.7 ~ log10(5).
Similarly, log10(3)*9 ~ 4 + log10(2); so, log10(3) ~ .477.
Other prime numbers use similar "easy power rules".
Now, what's log10(80)? It's .3*3 + 1 ~ 1.9. (The real value is 1.903...).
The log10(75) ~ .7*2+.477 = 1.877 (the real answer is 1.875...).
Just knowing some basic "small prime" logs lets you rapidly calculate logs in your head.
Also easy to remember: 7^4 = 2401 ~ 2400. log(2400) = log(3) + 3 log(2) + 2 ~ 19/40 + 3 * 12/40 + 2 = 135/40, so you get log(7) ~ 135/160 = 27/32 = 0.84375.
Also related: https://blog.timhutt.co.uk/fast-inverse-square-root/
(I see that someone already mentioned fast inverse square root algorithm is related to this, which is famously used by John Carmack which is one of my hero who led me into tech industry, despite I didn't end up in gaming industry)
It's still pretty cool to me that A this works and B it can be used to do so much.
> log(100)≤log(N)<log(100)
There is a missing 0 in the last log. It should be
> log(100)≤log(N)<log(1000)