Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Given a set of numbers, I need to find the lowest number that multiplying it with each of the numbers in the set results in a natural number, while being bigger or equal to $N$.

For example, for the numbers $2.2$, $3$ and $4.2$, the result could be $5$, $10$, $15$, etc as they can multiply $2.2$ and $4.2$ and result in natural numbers. Then, I need the lowest one that's higher than a given number.

I'm trying to implement it as a software algorithm in an efficient way. How would I go about doing that?

share|improve this question

1 Answer 1

First find the least common multiple of the denominators. You have to multiply by that to clear the fractions, so do so. Then if $a$ is the smallest number after multiplying by the LCM, divide $N$ by $a$ and round up to the next whole number. Call that $b$. The multiplier for the original set is $b*LCM$

share|improve this answer
    
Would that give me the smallest number possible? How would I go from there to finding the smallest one that's larger than N? –  shesek Oct 21 '12 at 19:52
    
@shesek: I misread the problem, thinking you just wanted the product larger than the largest in your original set. Fixed. –  Ross Millikan Oct 21 '12 at 21:59
    
When referring to "a is the smallest number", you mean after multiplying all the numbers by the lcm, right? –  shesek Oct 21 '12 at 22:24
1  
@shesek: It would be clearer to make it so. I was thinking that $a$ was the original smallest number, which is why I said to divide by $a * lcm$. Now it will just be $a$. I will update –  Ross Millikan Oct 21 '12 at 22:28
1  
@shesek: the LCM is taken over denominators. So if you have 3 and 7 and $N=50$, the LCM of the denominators is 1, then $b=17$ –  Ross Millikan Oct 21 '12 at 23:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.