| |
BGonline.org Forums
Is BGO an Elitist Society?
Posted By: Jason Lee In Response To: Is BGO an Elitist Society? (Chuck Bower)
Date: Friday, 12 December 2008, at 2:28 a.m.
In fact, a related trick from Benjamin is taking the squareroot. Take a guess and divide. Then average the quotient and divisor.
E.g. sqrt(499). I'll guess 20. Then average(20,25) = 22.5. My calculator sez 22.338... And my guess could have been even better (like 22, for example). That's part of the beauty of this shortcut; you don't even have to make the optimal guess.
The reason this works is because you're applying one iteration of what's called the Babylonian method for extracting square roots. It's an iterative algorithm for generating a sequence which converges very rapidly to the square root of any number. It converges so fast, that just one step will generally be good enough, especially if your initial guess is anywhere near reasonable.
http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
JLee
| |
BGonline.org Forums is maintained by Stick with WebBBS 5.12.