Question: Haskell Question Make a function factors which returns the factors of a given integer. Use a list comprehension in your code. Make a function isPrime
Haskell Question
Make a function factors which returns the factors of a given integer. Use a list comprehension in your code.
Make a function isPrime which is true if a given integer > 1 is a prime number, false otherwise.
Make a function primeFactors which returns the factors of an integer which are prime numbers. Use the filter function.
Example output:
> factors 30
[2,3,5,6,10,15,30]
> isPrime 30
False
> primeFactors 30
[2,3,5]
Thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
