LCM: Least Common Multiplier

Paul Chamberlain tif at doorstop.austin.ibm.com
Sat Jul 7 05:01:36 AEST 1990


In article <17000004 at uicsl.csl.uiuc.edu> nikki at uicsl.csl.uiuc.edu writes:
>I am looking for a program which is capable of computing LCM (Least Common
>Multiplier) of many numbers (Max. of ~20).

E-mail might be tricky -- besides I'm kind of proud of this.

I wrote a program (220 lines) that give GCD and LCM.  Most of it is a routine
that finds the next prime  :-).  Currently it will take as many numbers as
you like on the command line.  It is limited to long integer math.  For example

	lcm 20 36 48 72 34 8 38 24 22 112 46

gives

	LCM = 411863760
	GCD = 2


Mail to the path in my signature if you're interested.

Paul Chamberlain | I do NOT represent IBM	  tif at doorstop, sc30661 at ausvm6
512/838-7008	 | ...!cs.utexas.edu!ibmaus!auschs!doorstop.austin.ibm.com!tif



More information about the Comp.unix.questions mailing list