Código PHP:
<?php
$cap[1]="1+1"; $solu[1]="2";
$cap[2]="2+2"; $solu[2]="4";
$cap[3]="2+3"; $solu[3]="5";
$cap[4]="1+2"; $solu[4]="3";
$cap[5]="5+5"; $solu[5]="10";
$cap[6]="3+1"; $solu[6]="4";
$cap[7]="4+1"; $solu[7]="5";
$rand=rand(1,7);
$capm=$cap[$rand];
$solum=$solu[$rand];
echo '<input name="segu" type="hidden" id="segu" value="'.$solum.'"/>
<input type="text" name="captcha" id="textfield" />'; ?>