in reply to Re^3: OT: Finding Factor Closest To Square Root
in thread OT: Finding Factor Closest To Square Root
Another optimisation possible if N is odd, is to step back by 2 each time.And if N is even, factor out all the powers of 2, and run the algorithm against the remaining factor. For example,
which leaves1000 == 2**3 * 5**3
leading to125 == 5**3
as "close enough".5 * 2**2 == 20
-QM
--
Quantum Mechanics: The dreams stuff is made of
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: OT: Finding Factor Closest To Square Root
by BrowserUk (Patriarch) on Feb 20, 2005 at 15:26 UTC | |
by hv (Prior) on Feb 21, 2005 at 10:15 UTC | |
by BrowserUk (Patriarch) on Feb 21, 2005 at 17:56 UTC | |
by tall_man (Parson) on Feb 22, 2005 at 17:36 UTC | |
by BrowserUk (Patriarch) on Feb 22, 2005 at 19:14 UTC | |
|