The code is running fine on online Standard ML of New Jersey v110.78 but showing error on unix SNL/NJ .93. here is the code
fun check( num:int ) =
let
val x = List.tabulate(num, fn x => x*x)
val k =tl(x)
val y = List.filter( fn z => num mod z = 0)k
val ans = List.last(y)
val final = Real.ceil(Math.sqrt (Real.fromInt ans))
in
final
end;
val nu = check(8)
Errors are Unbound constructor or variable in tabulate, filter, last, ceil and unbound structure for Math.
It sounds like your standard library in this SML/NJ .93 is not properly configured. If you read the StackOverflow Q&A how to install SML-New jersey .93 version? you'll see that
I would recommend against using this version unless you're willing to deal with the consequences of running software that was not designed for the operating systems of our time, whether that is Windows or something else.