Question: You must implement three functions from each of the Math, . In some cases, these functions are already defined in Racket (DrRacket). To avoid confusion,
You must implement three functions from each of the Math, . In some cases, these functions are already defined in Racket (DrRacket). To avoid confusion, you can name yours differently, for example myreverse for reverse. Or you can just override the built-in definition. You may use other builtin functions, such as if, cond, car (first), cdr (rest), and cons in your functions. But you may not, of course, use a builtin function in your answer for that same function. (must be in real code)
You must implement at least three of these math functions.
1. Absolute value (abs 7) => 7 (abs -7) => 7
2. Factorial (factorial 5) => 120
3. Check if 3 integers can be the lengths of the two sides and the hypoteneuse of a right triangle (in that order) (right-tri 3 4 5) => #t (right-tri 1 2 3) => #f
4. Greatest Common Divisor (GCD) (gcd 8 12) => 4
5. Least Common Multiple (LCM) (lcm 4 6) => 12
6. Nth Fibonacci number (the first two Fibonacci numbers are both 1) (nth-fibo 6) => 8 (nth-fibo 10) => 55
7. Test if a number is prime (prime? 5) => #t (prime? 6) => #f
8. Nth prime number (the first prime number is 2) (nth-prime 6) => 13 (nth-prime 26) => 101
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
