n=$teller
bewerking=bewerking1.proc
!if $graad=0
    R=$teller
!else
    R=$graad
!endif  
letter1=!randitem a,k,q,u,x,c,n,z,s 
letter2=!randitem b,g,m,r,v,y,d,p,t
controle=$empty
antwoord=$empty
letterlijk=1
!if $R=1
    wims_rawmath_variables=$letter1
    varcnt=1
    getallen=2,3,4,5,6,7,8,9,10,12,14,16,18
    getallen=!shuffle $getallen
    !for p=1 to $aantal_vragen
	keuze=!randitem 1,2
	getal1=!item $p of $getallen
	getal2=!item $[$p+1] of $getallen
	pm=!randitem +,-
	!if $keuze=1
	    GOED=$letter1*($getal1*$letter1 $pm $getal2)
	!else
	    getal3=!item $[$p+2] of $getallen
	    getal4=!item $[$p+3] of $getallen
	    GOED=$letter1^$getal3*($getal1*$letter1^$getal4 $pm $getal2)
	!endif
	vraag=!exec pari $GOED
	som$p=!htmlmath $vraag
	controle=!append item $vraag to $controle
	GOED$n=!append item $GOED to $(GOED$n)
	htmlgoed=!htmlmath  $GOED
	antwoord=!append line <li>$(som$p) <font size="+1">=</font> $htmlgoed</li> to $antwoord
    !next p
!endif
!if $R=2 
    pm=!randitem +,-
    mp=!randitem +,-
    getallen=1,2,3,4,5,6,7,8,9,10
    getallen=!shuffle $getallen
    wims_rawmath_variables=$letter1
    varcnt=1

    !for p=1 to $aantal_vragen
	getal1=!item $p of $getallen
	getal2=!item $[$p + 1] of $getallen
	GOED=($letter1 $pm $getal1)*($letter1 $mp $getal2)
	vraag=!exec pari $GOED
	som$p=!htmlmath $vraag
	controle=!append item $vraag to $controle
	GOED$n=!append item $GOED to $(GOED$n)
	htmlgoed=!htmlmath  $GOED
	antwoord=!append line <li>$(som$p) <font size="+1">=</font> $htmlgoed</li> to $antwoord
    !next p
!endif
!if $R=3
    keuze=!randitem 1,2
    getallen=2,3,4,5,6,7,8,9,10
    getallen=!shuffle $getallen
    wims_rawmath_variables=$letter1
    varcnt=1
    !for p=1  to $aantal_vragen
	pm=!randitem +,-
	mp=!randitem +,-
	getal1=!item $p of $getallen 
	getal2=!item $[$p + 1] of $getallen
	!if $keuze=1 
	    getal3=!randitem -1,-2,-3,2,3,4,5
	    GOED=$getal3*($letter1 $pm $getal1)*($letter1 $mp $getal2)
	!else
	    GOED=$letter1*($letter1 $mp $getal1)*($letter1 $pm $getal2)
	!endif    
	vraag=!exec pari $GOED
	controle=!append item $vraag to $controle
	som$p=!htmlmath $vraag
	GOED$n=!append item $GOED to $(GOED$n)
	htmlgoed=!htmlmath  $GOED
	antwoord=!append line  <li>$(som$p) <font size="+1">=</font> $htmlgoed</li> to $antwoord

    !next
!endif
!if $R>3
#bolleboosjes
    controle=
    getal1=!randitem 2,3,4,5,6,7,8,9
    pm=!randitem +,-
    mp=!randitem +,-
    wims_rawmath_variables=$letter1,$letter2
    varcnt=2

    !for p=1 to $aantal_vragen
	keuze=!randitem 1,2
	!if $keuze=1
	    getal2=!randitem -1,-2,-3,-4,2,3,4
	    getal3=!randitem 1,2,3
	    GOED=($getal2*$letter1 $mp $getal1)*($letter1 $pm $getal3)
	!else
	    GOED=$getal1*($letter1 $mp $letter2)*($letter2 $pm $letter1)
	!endif
    	vraag=!exec pari  $GOED 
	controle=!append item $vraag to $controle
	som$p=!htmlmath $vraag 
	GOED$n=!append item $GOED to $(GOED$n)
	htmlgoed=!htmlmath  $GOED
	antwoord=!append line  <li>$(som$p) <font size="+1">=</font> $htmlgoed</li> to $antwoord
    !next
!endif

PLAATJE=0
!if $taal=nl
nivo_title=Ontbind in Factoren<br> schrijf met haakjes...	
somtekst$n=Vul in en schrijf met haakjes (ontbind in factoren)
antwoord$n=<table width="100%"><td><ol>$antwoord</ul></td></table>
    !if $HINT=1
	hint=<p align="left"><font color=$fontcolor2>Algemene Hint:</font><br>\
	Met ontbinden in factoren bedoelen we het tussen haakjes brengen...<br>\
	Bijvoorbeeld: stel de functie luidt <em>x<sup><small>4</small></sup> + <em>x<sup><small>5</small></sup><br>\
	dan is <em>x<sup><small>4</small></sup>(1+x)</em> de ontbinding...<br>Snap je, $voornaam?
    !endif  
!else
    nivo_title=Factoring<br> rewrite with brackets.	
    somtekst$n=Fill in and write with brackets (factorization or factoring)	
    antwoord$n=<table width="100%"><td><ol>$antwoord</ul></td></table>
!endif      