Assignment 1

Problems

Pick three of the following.

  1. Implement the map function using a fold.

  2. Implement the filter function using a fold.

  3. Implement foldl using foldr.

  4. Write code to compute the smallest positive number that is evenly divisible by all the numbers from 1 to \(n\). Provide an answer for \(n = 20\).

    Output: 232792560.

  5. Write code to compute the \(n\)th prime number. Provide an answer for \(n = 10001\).

    Output: 104743.

References