!if $taal=nl
    nivo_title=Vereenvoudig de breuk
    somtekst1=Vereenvoudig zo ver mogelijk:<br>
!else
    nivo_title=Reduce the Fraction
    somtekst1=Recduce the fraction as far as you can:<br>
!endif
bewerking=bewerking1.proc
!if $negatief=0
    lijst_a=!shuffle 3,5,3,5,3,5,7
    lijst_b=!shuffle 2,4,6,2,4,6
    lijst_c=!shuffle 9,10,11,12,13,15
    lijst_d=!shuffle 2,4,6,8,10,12,14
!else
    lijst_a=!shuffle 1,2,4,6,-1,-2,-4,-6,-1,-2,-4,-6
    lijst_b=!shuffle 3,5,7,9,-3,-5,-7,-9
    lijst_c=!shuffle 10,11,12,13,14,15,16,-10,-11,-12,-13,-14,-15,-16
    lijst_d=!shuffle 2,4,6,8,10,-2,-4,-6,-8,-10
!endif
    
totaal=$empty
R=$graad

!for n=1 to $aantal_sommen
    !if $graad=0
	R=$n
    !endif
    !if $R=1
	s=!randitem 2,3,4
	a=!item $n of $lijst_a
	a=$[$n*$a]
	b=$[$s*$n*$a]
    !endif    	
    !if $R=2
	a=!item $n of $lijst_a
	b=!item $n of $lijst_b
	a=$[2*$n*$a]
	# ik wil nog geen negatieve noemers bij R=2
	b=$[abs(4*$n*$b)]
    !endif    	
    !if $R>2
        a=!item $n of $lijst_a
        b=!item $n of $lijst_b
        c=!item $n of $lijst_c
        d=!item $n of $lijst_d
	a=$[2*$a*$c]
	b=$[4*$b*$d]
    !endif    	
    som$n=$a/$b 
    opgave$n=\frac{$a}{$b} 
    totaal=!append line $(som$n) to $totaal
    totaal=!append line printtex($(som$n)) to $totaal 
!next n

totaal=!exec pari $totaal
i=1
!for n=1 to $aantal_sommen
    GOED$n=!line $i of $totaal
    goed$n=!line $[$i+1] of $totaal
    i=$[$i+2]	 
!next n
