>function try24 (v) ... $n=cols(v); $if n==1 and v[1]~=24 then $ "Solved the problem", $ return 1; $endif $loop 1 to n $ w=tail(v,2); $ loop 1 to n-1 $ h=w; a=v[1]; b=w[1]; $ w[1]=a+b; if try24(w); ""+a+"+"+b+"="+(a+b), return 1; endif; $ w[1]=a-b; if try24(w); ""+a+"-"+b+"="+(a-b), return 1; endif; $ w[1]=a*b; if try24(w); ""+a+"*"+b+"="+(a*b), return 1; endif; $ if not b~=0 then $ w[1]=a/b; if try24(w); ""+a+"/"+b+"="+(a/b), return 1; endif; $ endif; $ w=rotright(w); $ end; $ v=rotright(v); $end; $return 0; $endfunction