We don't bite newbies here... much | |
PerlMonks |
Re^3: OT: Finding Factor Closest To Square Rootby talexb (Chancellor) |
on Feb 19, 2005 at 00:58 UTC ( [id://432591]=note: print w/replies, xml ) | Need Help?? |
If you get a list of prime factors in ascending order, then I would take every other member of the list, multiply them together and start with that. In your example, that would give you 20, which isn't too far from the correct result of 31. Hmm .. Actually, an even better answer would be
For your example, that would be 2 * sqrt(2*5) * 5, which turns out to be exactly the correct answer, 31.622.. To try out the odd number, we'll try out 2000, which gives us a list of (2, 2, 2, 2, 5, 5, 5) and a result of 2 * 2 * 5 * 5 or 100. Hmm, a little high. Well, that's a fascinating question, and good luck with that. Alex / talexb / Toronto "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds
In Section
Seekers of Perl Wisdom
|
|