Subversion Repositories wimsdev

Rev

Blame | Last modification | View Log | RSS feed

!goto $wims_read_parm

:def
title=Least Common Multiple
synonyme=lcm
input=list
!exit

:proc

n=!itemcnt $formula
!if $n<=1
 result=$[$formula]
 !exit
!endif

u=!item 1 of $formula
v=!item 2 of $formula
u=!rawmath $u
v=!rawmath $v
src=lcm($u,$v)
!if $n>2
 !for i=3 to $n
  v=!item $i of $formula
  v=!rawmath $v
  src=lcm($src,$v)
 !next i
!endif
result=!exec pari $src
!exit

:output

!htmlmath lcm($formula) = $result
 .
!exit