1

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?

RedPython
  • 185
  • 4

1 Answers1

4

Use Apply, or its short form @@:

LCM @@ Range[5]
(* 60 *)
John Doty
  • 13,712
  • 1
  • 22
  • 42