OMG!
I am such a dumbf***.
Why haven't I seen this on sunday morning

 Code:
function a($)
    dim $b, $d
    $b = 0^$
    while $
        $a = (($b-($^) & 1)+1) * right($,1)
        $d = $d + $a-9*($a>9)
        $a = ($d mod 10 =) * ($>2&$<7&$b+($<4)=16) * $
        $ = left($,~)
endfunction


= 137

and the same for my other version:

 Code:
function a($)
    dim $b, $c, $e
    $e = $^0
    while $
        $b = ~$b
        $a = (2+$b) * right($,1)
        $c = $c + $a-9*($a>9)
        $a = ($c mod 10 =) * ($>2&$<7&$e+($<4)=16) * $
        $ = left($,~)
endfunction


= 137 as well..


Edited by Jochen (2010-08-09 10:39 PM)
Edit Reason: blargh
_________________________