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: [mg43305] Re: LCM With Variable Number of Arguments
  • From: bobhanlon at aol.com (Bob Hanlon)
  • Date: Sun, 24 Aug 2003 04:55:01 -0400 (EDT)
  • References: <bi7nme$p9k$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

LCM is Listable so it requires a Sequence not a List

myList = { 2, 3, 4, 5 };

LCM[Sequence@@myList]

60


Bob Hanlon

In article <bi7nme$p9k$1 at smc.vnet.net>, mlookabaugh at NO_ADS.cox.net (Mark
Lookabaugh) wrote:

<< 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?


  • Prev by Date: Re: Data Manipulation
  • Next by Date: Numerical Integration of Large Expression
  • Previous by thread: Re: ParametricPlot3D Options
  • Next by thread: RE: LCM With Variable Number of Arguments