MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: LCM With Variable Number of Arguments

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43298] RE: [mg43279] LCM With Variable Number of Arguments
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sun, 24 Aug 2003 04:54:55 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Mark,

LCM does not work on lists, but on arguments. Use the Apply function.

LCM @@ {2, 3, 4, 5}
60

list = {1, 2, 6, 5, 3};
LCM @@ list
30

The list can be any length.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 

From: Mark Lookabaugh [mailto:mlookabaugh at NO_ADS.cox.net]
To: mathgroup at smc.vnet.net

Hi,

I have a list of numbers, and I'd like to get the LCM of all the
values in the list.  The list isn't always the same length at runtime.

What's the syntax to specify that?

For example:

If I have myList = { 2, 3, 4, 5 }
I'd like to do something like LCM[myList] and get 60.  

but that actually returns { 2, 3, 4, 5 }  (I guess performing LCM on
each element individually).  

How can I get LCM to act on a bunch of values at once?

Thanks for any help,
Mark

--
Mark Lookabaugh
mlookabaugh (at) cox.net
USS Brewton FF-1086 Home Page
http://www.ussbrewton.com


  • Prev by Date: Numerical Integration of Large Expression
  • Next by Date: Re: FITS - Display problem
  • Previous by thread: Re: LCM With Variable Number of Arguments
  • Next by thread: Re: LCM With Variable Number of Arguments