Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^5: OT: Finding Factor Closest To Square Root

by dragonchild (Archbishop)
on Feb 20, 2005 at 22:11 UTC ( [id://432905]=note: print w/replies, xml ) Need Help??


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

My method actually gives 2**1.5 * 5 ** 1.5, which is the actual square root of 1000. Coming up with 25 or 40 is going to be ... interesting. I can do further research into the mathematics behind it, if you want. (Number Theory is a pet project of mine.)

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Replies are listed 'Best First'.
Re^6: OT: Finding Factor Closest To Square Root
by QM (Parson) on Feb 21, 2005 at 01:20 UTC
    I can do further research into the mathematics behind it, if you want. (Number Theory is a pet project of mine.)
    I'd be interested in any insights you have. I keep poking at number theory ideas, but I never get anywhere.

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

      Here's the gist - you have a list of @prime_factors. You need to break them apart into two other lists, then multiply the values in each list together to get two numbers. The goal is to get the two numbers closest to one another. Those will be your factors closest to the square root.

      However, it's not as easy as it seems. When working with 1000, I tried taking the largest root, then as many of the smallest roots to match it, and so forth ... and it worked. I get 5*5 and 2*2*2*5. But, if you work with 700, you get 7*5 and 2*2*5, which isn't right - you should get 2*2*7 and 5*5.

      I think I'm going to leave the problem in your capable hands. You've got a roadmap - have fun! :-)

      Being right, does not endow the right to be rude; politeness costs nothing.
      Being unknowing, is not the same as being stupid.
      Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
      Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://432905]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-24 19:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found