|
|
- MathsIsFun
- Administrator

Least Common Multiple Calculator
I have updated this page: Least Common Multiple Calculator
Could you throw some numbers at it and let me know if it behaves itself, thank you.
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
- bobbym
- Administrator

Re: Least Common Multiple Calculator
Hi MIF;
It is a nice little calculator. Very good!
In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics.
Re: Least Common Multiple Calculator
Seems to work like a charm!! Did 2 and 3 numbers filled in, primes and related multiple cousins etc.
Imagine for a moment that even an earthworm may possess a love of self and a love of others.
- MathsIsFun
- Administrator

Re: Least Common Multiple Calculator
Thanks both.
Quality control 
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
- MathsIsFun
- Administrator

Re: Least Common Multiple Calculator
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
- MathsIsFun
- Administrator

Re: Least Common Multiple Calculator
New version (0.6): Least Common Multiple Calculator
I upgraded it to use my "Full Precision" functions, so it can handle larger numbers, so lots of changes to internal calcs.
Again, could you throw some numbers at it?
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
- bobbym
- Administrator

Re: Least Common Multiple Calculator
Hi;
It is working fine. No problems.
In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics.
Re: Least Common Multiple Calculator
Hi MIF!
Did you mean for it to work with decimals too? The few I tested worked. Did you mean for it to work with negative numbers? That didn't work.
Works nice for positive integers.
You might consider limiting the inputs to just positive integers. Zero poses a problem, since any number times zero equals zero. multiplies of zero are 0,0,0,... The multiples of 2 are 0,2,4,6,... So accordingly lcm(0,2) would be zero.
People are going to try to input all kinds of numbers if there are no restrictions. It may be better to simply not accept their inputs rather than accept the inputs and then not get an answer or get an answer they can't understand. 
Writing "pretty" math (two dimensional) is easier to read and grasp than LaTex (one dimensional). LaTex is like painting on many strips of paper and then stacking them to see what picture they make.
Re: Least Common Multiple Calculator
lcm is defined for positive integers only, so why should anyone input anything else, besides their curiosity?
The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “A secret's worth depends on the people from whom it must be kept.” ― Carlos Ruiz Zafón
- MathsIsFun
- Administrator

Re: Least Common Multiple Calculator
I could reject the "-" sign.
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
Re: Least Common Multiple Calculator
Hi MIF!
You could allow the minus sign, since according to Wikipedia the lcm of two integers is the smallest POSITIVE integer that is divisible by both. In essence the minus signs are just ignored. Wiki also says that if either a or b is zero then the lcm is zero.
I've never seen lcm applied to decimals although your program seems to work accepting them as input but treats them as if they had no decimals and then outputs the correct integer accordingly but puts a decimal in the answer so that both inputs divide into it an INTEGRAL number of times.
If I input 2.43 and 8.1 into your program it outputs 24.3 which both 2.43 and 8.1 divide into an INTEGRAL number of times. So maybe you've come up with a way to define lcms of terminating decimals! Inputting .166 and .333 gives 55.278 which both .166 and .333 divide into an INTEGRAL number of times. Perhaps this could be extended to fractions if we write them in a base that makes BOTH of them TERMINATING decimals???
Hmmmmmmmm... 
Writing "pretty" math (two dimensional) is easier to read and grasp than LaTex (one dimensional). LaTex is like painting on many strips of paper and then stacking them to see what picture they make.
- MathsIsFun
- Administrator

Re: Least Common Multiple Calculator
Thanks noelevans, well argued and well said.
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
Re: Least Common Multiple Calculator
Hi again! 
Take the equation
x 3x ----- + ----- = 10 and multiply both sides by the lcm 24.3 that your program gives. 2.43 8.1
Then we get 10x + 9x = 243 so 19x=243 so x=12.789. So maybe there are some decent applications for the concept.
Of course we could have multiplied the equation through by both 8 .1 and 2.43 and solved, but then we would have had decimal coefficients for the variable. 8.1x + 3(2.43)x = 10(8.1*2.43) 8.1x + 7.29x = 196.83 15.39x = 196.83 x = 196.83/15.39 x = 12.789
Does make the arithmetic a bit easier!
But perhaps we can get lcms for fractions a/b and c/d in the sense that we are looking for the smallest fraction that both a/b and c/d divide into giving integers.
Example: 15/77 and 25/49 and see if 75/7 does the trick. (75/7)/(15/77)=(75*77)/(7*15)=5*11=55 and (75/7)/(25/49)=(75*49)/(25*7)=3*7=21 which yields integral values for each division. x x So given ------ + ------- = 7 and multiplying both sides by 75/7 we obtain 15/77 25/49
55x + 21x = 7*(75/7) = 75 x = 75/76 It looks like lcm(a/b,c/d) = lcm(a,c)/hcf(b,d)
Example: lcm(1/4,1/6) = lcm(1,1)/hcf(4,6) = 1/2. (1/2)/(1/4)=2 and (1/2)/(1/6) = 3. Example: lcm(4,6) = lcm(4/1,6/1) = lcm(4,6)/hcf(1,1) = 12/1 = 12. (Works for integers) Example: lcm(2/3,6/15) = lcm(2,6)/hcf(3,15) = 6/3 = 2 2/(2/3) = 3 and 2/(6/15) = 5
Hmmmmmm. This might at times be an easier approach to solving equations involving fractions.
But of course for just two fractions we could replace lcm(a,c) with ac/hcf(a,c) so the formula would become lcm(a/b,c,d) = ac/(hcf(a,c)*hcf(b,d))
And would lcm(a/b,c/d,e/f) = lcm(a,c,e)/hcf(b,d,f) etc. for more than two fractions?
Your program is generating some interesting questions! 
Writing "pretty" math (two dimensional) is easier to read and grasp than LaTex (one dimensional). LaTex is like painting on many strips of paper and then stacking them to see what picture they make.
Re: Least Common Multiple Calculator
Writing "pretty" math (two dimensional) is easier to read and grasp than LaTex (one dimensional). LaTex is like painting on many strips of paper and then stacking them to see what picture they make.
- MathsIsFun
- Administrator

Re: Least Common Multiple Calculator
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
Re: Least Common Multiple Calculator
The gcd calculator seems to work fine for positive integer inputs. I input negative integers, decimals and fractions and it just returned 1 in every case although it allows inputting these (fractions in form a/b) forms. I have written many programs in BASIC and have had to try to "idiot-proof" them. It's difficult to anticipate what other people might do. Somewhere down the line when you have a good chunk of time (if ever) it would be nice to have a calculator that allows the input of integers, decimals and fractions as well as positive integers and then have the program calculate both the lcm and gcd for the input set of numbers. You could have the first site on the internet that does these calculations for all these kinds of inputs. It might generate a good bit of curiosity and cause a bit more membership and traffic on the site.

Writing "pretty" math (two dimensional) is easier to read and grasp than LaTex (one dimensional). LaTex is like painting on many strips of paper and then stacking them to see what picture they make.
- MathsIsFun
- Administrator

Re: Least Common Multiple Calculator
The LCM calculator is a Flash App that uses my "full precision" library
But the GCF calculator is a fairly simple javascript program ... I could re-make it in Flash.
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
- MathsIsFun
- Administrator

Re: Least Common Multiple Calculator
I adapted the LCM calculator as a GCF calculator!
Here: Greatest Common Factor Calculator
Have a play, tell me what works/doesn't work.
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
Re: Least Common Multiple Calculator
Hi MIF;
This is a very good job. Congratulations!
Winter is coming.
Re: Least Common Multiple Calculator
Hello again MIF, 
The gcf, gcd, hcf, hcd calculator seems to work just fine. Works with negative numbers and with decimals too. And if one tries to input fractions with the "/" it just ignores the "/". Good work!
I'm still working on the lcm and gcd of fractions trying to get equivalent formulations and examples of problems that it can apply to.
Have a great day!
Writing "pretty" math (two dimensional) is easier to read and grasp than LaTex (one dimensional). LaTex is like painting on many strips of paper and then stacking them to see what picture they make.
Re: Least Common Multiple Calculator
Hi again! 
An interesting note:
Assume a,b,c,d are integers in the following and that the fractions are in reduced form. (It still seems to work OK even if the fractions are not reduced.)
Using hcf(a/b,c/d)=hcf(a,c)/hcf(b,d) and lcm(a/b,c/d)=lcm(a,c)/hcf(b,d) works for whole numbers like 10 and 15 written as 10/1 and 15/1.
Example1: hcf(10,15) = hcf(10/1, 15/1) = hcf(10,15)/hcf(1,1) = 5/1 = 5. lcm(10,15) =lcm(10/1, 15/1) = lcm(10,15)/hcf(1,1) = 30/1 = 30 and hcf*lcm=5*30=150=10*15
So whole numbers (and so also integers) also work under the definition of hcf for fractions with the usual M*N=lcm(M,N)*hcf(M,N) formula intact.
BUT for other kinds of fractions this product of the original two numbers equals the product of the hcf and lcm does NOT necessarily work.
Example2: hcf(1/10, 1/15) = hcf(1,1)/hcf(10,15) = 1/5. lcm(1/10,1/15) = lcm(1,1)/hcf(10,15) = 1/5 so hcf*lcm = (1/5)(1/5)=1/25 whereas (1/10)(1/15) = 1/150. The hcf*lcm is missing the other factor of each of the 10 and 15. So we only get the 5 and 5 but not the other factors 2 and 3.
Example3: hcf(15/8, 25/6) = hcf(15,25)/hcf(8,6) = 5/2. lcm(15/8, 25/6) = lcm(15,25)/hcf(8,6) = 75/2. so hcf*lcm = 375/4 whereas (15/8)(25/6)=375/48. So again we are missing the other factors in the denominator. The numerators are always the same since they are a product of the lcm and hcf of INTEGERS.
So it looks like in the case of integers, we get hcf(M,N)*lcm(M,N)=M*N as a SPECIAL CASE of the more general definition of lcm and hcf because the denominators are both 1's.
Example4: hcf(10/7, 15/7)=hcf(10,15)/hcf(7,7) = 5/7. lcm(10/7, 15/7)=lcm(10,15)/hcf(7,7) = 30/7. So hcf*lcm = (5/7)(30/7) = 150/49 and (10/7)(15/7) = 150/49. So if BOTH denominators are the SAME then the product of the original numbers = lcm*hcf holds.
Example5: hcf(10/3, 15/7)=hcf(10,15)/hcf(3,7) = 5/1 = 5. lcm(10/3, 15/7)=lcm(10,15)/hcf(3,7) = 30/1 = 30. so hcf*lcm = 5*30=150 whereas (10/3)(15/7)=150/21 Again these are not equal.
CONCLUSION1: THE lcm*hcf BEING EQUAL TO THE PRODUCT OF THE original two numbers ONLY WORKS WHEN THE TWO NUMBERS HAVE THE same DENOMINATOR. Of course, integers are written over 1 to make them fractions for the formula.
CONCLUSION2: The old trick of calculating the lcm by dividing the product of the original numbers by the hcf cannot be used when dealing with fractions unless their denominators are the same.
CONCLUSION3: Given fractions a/b and c/d with a,b,c,d integral the equality lcm(a/b, c/d) = a*c/(hcf(a,c)*hcf(b,d)) is I believe true because we can substitute lcm(a,c) = a*c/hcf(a,c) since a and c are integers.
CONCLUSION4: Given a/b and c/d if gcd(b,d)=1 then the lcm and hcf of the two fractions are integers. See example 5. Furthermore they are the lcm and hcf of just the numerators.
So MIF, can I blame my lack of sleep on you? You really got my mind a buzzin' with your lcm calculator! 
P.S. The decimals seem to still work for the lcm and gcd calculators and seem to give the same answer when changed into fractions.
Writing "pretty" math (two dimensional) is easier to read and grasp than LaTex (one dimensional). LaTex is like painting on many strips of paper and then stacking them to see what picture they make.
|