Re: Problem with EDOM2
- Posted by Lmailles <Lmailles at AOL.COM> Dec 28, 1997
- 660 views
> I have three (floating or not values) v1, v2 and v3. > v1 / v3 makes an integer > v2 / v3 makes an integer > > I dunno v3, I do know v1 and v2. > How should I get v3 ?? What you are looking for is a common factor of v1 and v2 ie a number which goes into both. A human brain would do this intuitively, but what you need to do depends on the outcome required ie do you want the HIGHEST common factor, the LOWEST or just any old one ? Would you prefer an integer or not ? If you want an integer then find the factors of each, compare them, and choose the most useful number that appears in both lists. --Prog to find factors sequence factors atom v,res for a=1 to floor(v/2) do res=v mod a -- find remainder, syntax may be incorrect if res=0 then factors=factors&res end if next Daniel