Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Symbolic programming using Haskell programming code. In this assignment, you are going to write a Haskell function factor to find all proper factors of a
Symbolic programming using Haskell programming code.
In this assignment, you are going to write a Haskell function factor to find all proper factors of a positive Integer. Given a positive Integer value n, a proper factor is defined to 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 both 1 and n are divisible by n, they are not proper factors of n. The function factor has the following type signature: factor: Integer ->[Integer] That is, it takes an Integer and returns a list of Integer. The elements in the list are all proper factors of the parameter, and they must be in ascending order. The followings are some examples: .factor 843 13, 281 .factor 3281 > [17, 193 .factor 6912> [2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 27, 32, 36, 48, 54, 64, 72, 96, 108, 128, 144, 192, 216, 256, 288, 384, 432, 576, 768, 864, 1152, 1728, 2304,3456) [3, 23, 69, 97, 291, 2231) . factor 6693 factor 2778 [2, 3, 6,463, 926, 1389 .factor 4027 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started