fun check(m:int):bool = if ((m-6) mod 13)=0 then true else false; fun average(m:int,n:int):real = ((real(m)+real(n))/2.0); fun positive(m:(real->real),n:real):real = if (m(n) >= 0.0) then m(n) else 0.0; fun duplicate(m:string):string = m^m; fun f(x:int):int = 10 * f(x mod 10); fun sum(x:int, f:(int->real)):real = if x <= 0 then 0.0 else f(x)+sum(x-1,f); fun sumix(x:int, ix:(int->int), f:(int->real)):real = if x <= 0 then 0.0 else f(ix(x))+sumix(x-1,ix,f); fun findmax(n:int, c:int) = if ((n mod c) = 0) then c else findmax(n, c-1); fun maxfactor(n:int):int = findmax(n,n-1);