Question: In this assignment, you are going to write a Haskell function named factors to find all proper factors of a positive Integer. Given a positive

In this assignment, you are going to write a Haskell function named factors to find all proper factors of a
positive Integer.
Given a positive Integer value n, a proper factor of n is defined to be an Integer value i between 1 to n
(exclusively) such that n is divisible by i; that is, the remainder of dividing n by i is zero (0). Note that although
n is divisible by both 1 and n, they are not proper factors of n.
The function factors has the following type signature:
factors :: Integer [Integer]
That is, it takes an Integer as its only parameter and returns a list of Integers. The elements in the list are
all proper factors of the parameter, and they must be all unique and in ascending order.
Here are some examples:
factors ,
154,176,224,308,352,616,1232
factors ,
factors 9676[2,4,41,59,82,118,164,236,2419,4838]
factors 1179[3,9,131,393]
factors 4639[]
Note that the output for the last example is an empty list since 4,639 is a prime number and it has no proper
factor.
Download the three files "CSC207a3.hs","CSC207a3Tester.hs", and "CSC207a3TestData.hs" from
Canvas and save them in the same folder. The last two files are the tester program and the test data file,
respectively. Do not modify these two files. The first file is the file you will work on. Note that you cannot
rename this file and you cannot change the name of the function (otherwise the tester will not be able to pick
up your implementation). However, you can change the names of the parameters if you like. Also note that
the first line is required for the tester to locate your code so do not modify it.
The file "CSC207a3. hs" contains a dummy implementation of the function that always returns a singleton list
with the input parameter as its only element (since a value cannot be a proper factor of itself, it is always
incorrect). The contents of the file "CSC207a3.hs" is listed here for your reference: factors :: Integer ->[Integer]
factors n =[n]
 In this assignment, you are going to write a Haskell function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!