in reply to Re^2: OT: Finding Factor Closest To Square Root
in thread OT: Finding Factor Closest To Square Root

Since you've got them in ascending order, take every other prime factor and multiply. Compare that to the product of the ones you didn't choose. Whichever's closer, there ya go. That's just off the top of my head.

Let's try another way. Pretty clearly, you want roughly half the factors. You can work from the outside in, or the inside out, or do something like this: If you have N factors, take the (N*2)th root of the number. Find the factor closest to that. Divide your number by the square of the chosen factor, decrement N, and repeat until you get further from the square root instead of closer to it.


Caution: Contents may have been coded under pressure.
  • Comment on Re^3: OT: Finding Factor Closest To Square Root

Replies are listed 'Best First'.
Re^4: OT: Finding Factor Closest To Square Root
by QM (Parson) on Feb 20, 2005 at 04:50 UTC
    Your first suggestion is practical, and will probably suit my needs.

    Your second suggestion, well, perhaps you typoed? I just don't get it.

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of