Blame | Last modification | View Log | RSS feed
!goto $wims_read_parm
:def
title=Greatest Common Divisor
synonyme=gcd
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=gcd($u,$v)
!if $n>2
!for i=3 to $n
v=!item $i of $formula
v=!rawmath $v
src=gcd($src,$v)
!next i
!endif
result=!exec pari $src
!exit
:output
!htmlmath gcd($formula) = $result
.
!exit