Module Specifications.Assign00

Assignment 0

This assignment is due on Friday 9/6 by 11:59PM. It's not graded, it's just a practice run so you can verify that everything is set up correctly on your computer.

Problem 1: Square Root

val sqrt : int -> int

Implement the function sqrt which, given a nonnegative integer n, returns the smallest value k such that n \leq k^2 .

Put your solution into the file assign00_01.ml in the directory assign00/lib. See the file test/test_suite/test_01.ml for example output behavior.

Problem 2: Primality

val is_prime : int -> bool

Implement the function is_prime which, given an integer n, returns whether or not n is prime as a boolean value. Recall that all integers less than 2 are not prime.

Put your solution into the file assign00_02.ml in the directory assign00/lib. See the file test/test_suite/test_02.ml for example output behavior.