9. An integer a is said to be a type 0 integer if there exists an...
Haskell coding problem please do the last 3
Problem One (Non-Polymorphic Type Inference): Give the type of the following expressions. We assume that we can have Integer and Bools as defined in the Haskell Prelude. Assume that all arithmetic operators in these examples operate only on Integers, so the type of (+) is Integer->Integer -» Integer. data D a = A Integer | B Bool | C a data Pair a b = Pab data List aNil | Cons a...
Exercise 3. [10 pts Let n 2 1 be an integer. Prove that there exists an integer k 2 1 and a sequence of positive integers al , a2, . . . , ak such that ai+1 2 + ai for all i-1, 2, . . . , k-1 and The numbers Fo 0, F1 1, F2 1, F3 2 etc. are the Fibonacci numbers
5. Let AE Maxn(C). Recall that A is said to be nilpo tent if there exists a positive integer k such that A 0. Prove the following statements (a) If A is nilpotent, then A 0. (Hint: First show that if A is nilpotent, then the Jordan form of A is also nilpotent.) (b) If A is nilpotent, then tr(A) 0 (e) A is nilpotent if and only if the characteristic polynomial of A is (-1)"" (d) If A is...
Problem of the Week #4 1. An integer bis said to be divisible by an integer a 0, in symbols ab. if there exists some integer c such that b = ac. In other words, b is divisible by a if a goes into b with no remainder. For example, 30 is divisible by 5 (in symbols, 5 30 ) because 30 = 5 x 6. Problem of the Week: The following integers are all divisible by 31: 28272, 27683,...
question 5
5. (a) Informally find a positive integer k for which the following is true: 3n + 1 < n2 for all integers n > k-4 (b) Use induction to prove that 3n +1 < n2 for all integers n 2 k. 6. Consider the following interval sets in R: B-4.7, E = (1,5), G = (5,9), M-[3,6]. (a) Find (E × B) U (M × G) and sketch this set in the-y plane. (b) Find (EUM) x (BUG)...
proofs For this assignment, know that: An integer is any countable number. Examples are: -3, 0, 5, 1337, etc. A rational number is any number that can be written in the form a/b, a and b are integers in lowest terms, and b cannot equal 0. Examples are 27, 22/7, -3921/2, etc. A real number is any number that is not imaginary or infinity. Examples are 0, 4/3, square root of 2, pi, etc. 1. Prove or disprove: There exists...
Question 16 (4 points) Write a complete C program that declares four variables of type integer (i.e integer variables) and four variables of type pointer to integer (i.e. integer pointers). Assign the addresses into the pointers. Using the indirection operator with a pointer, assign the values 1, 2, 3, and 4 into the four integers. (Use the indirection operator with the pointers to write the integer values.) Your program should write the addresses and values of all eight variables to...
Haskell coding problem please do problem two
Here is problem one for the types
Problem Two (Polymorphic Type Inference): Give the type of the following functions in the space indicated. Assume that we have only the types given in Problem One, plus Haskell's built-in types Integer and Bool. Assume that all arithmetic operators take only Integer, e.g., () is Integer -> Integer -> Integer. test :: test x xs = (Cons x (Cons (x+1) xs)) second second xs = f...
Give a proof or counterexample, whichever is appropriate. 1. For any sets A and B, (A ∩ B = ∅) AND (A ∪ B = B) ⇒ A = ∅ 2. An integer n is even if n2 + 1 is odd. 3. The converse of the assertion in exercise 62 is false. 4. For all integers n, the integer n2 + 5n + 7 must be positive. 1.65. For all integers n, the integer n4 + 2n2 − 2n...
1. An integer is said to be perfect if the sum of its factors, including 1, is equal to the number itself. Write a Prolog predicate perfect(N, F), which determines if integer N is perfect and if so, return it’s list of factors F. If N is not perfect, the predicate fails. You may find the arithmetic operation M mod N to be useful. Test your predicate on the following. • perfect(6, Factors) ⇒ Factors = [1, 2, 3] •...