Function A($)
$a = $^0 ;no need for long keywords like len()
dim $i, $x, $b[$a-1] ;$l removed using $a instead
;redim $b[$a-1] ;no need to redim if doing right in the start ;)
for $i = 0 to $a-1
$b[$i] = substr($,$i+1,1)
next
for $i = $a-2 to 0 step -2
$x = 2*$b[$i]
; $b[$i] = iif($x>9,0+left($x,1) + right($x,1),$x) redone without lettercode (right replaced with mod).
;$b[$i] = iif($x>9,0+left($x,1) + $x mod 10,$x) x cannot be more than 18, so removing left(). also removing iif.
$b[$i] = $x-9*($x>9)
next
$i = execute("$X="+join($b,'+'))
$a = ($>3 & $<7 & $a=16-($<4) & $x mod 10=)*left($,1)
Endfunction