1
$\begingroup$

If I enter LCM[1,2,3,4,5] 60 is returned. if I enter LCM[Range[5]] {1,2,3,4,5} is returned.

I think I understand why it returns a list. (because it is treating the list as one argument?)

How can I use the output from the Range function act as individual arguments in the LCM function? How do I change LCM[Range[5]] so that it too returns 60?

$\endgroup$
0

1 Answer 1

4
$\begingroup$

Use Apply, or its short form @@:

LCM @@ Range[5]
(* 60 *)
$\endgroup$

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