In both Haskell AND Python

Instructions
In both Haskell AND Python
1) Using list comprehension give an expression that calculates the sum of the squares of the first hundred integers.
2) Define a function factors that maps a positive integer to a list of positive integers. i.e. factors 15 -> [1,3,5,15]
3) A positive integer is perfect if it equals the sum of its factors, excluding the number itself. i.e. 6 = 1+2 +3. Using list comprehension and the function factors, define a function perfects :: Int -> [Int] that returns the list of all perfect numbers up to a given limit. i.e. perfects 30 -> [6,28]

© 2020 customphdthesis.com. All Rights Reserved. | Disclaimer: for assistance purposes only. These custom papers should be used with proper reference.