problem 3 solved in f#