HOMEWORK 4. 1. Write a program for factorial computation using an accumulator. ================================================= 2. Write a program sum_and_squaresum that from a given list of numbers finds the sum of its elements and the sum of their squares. Use accumulators. Sample run: ?- sum_and_squaresum([1,-3,2,0],Sum,SQS). Sum = 0 SQS = 14 ; No ======================================================== 3. Write a predicate twice_as_long(L1,L2) that succeeds if the list L2 is twice as long as the list L1. Do NOT compute the lengths of the lists. Sample run: ?- twice_as_long([],[]). Yes. ?- twice_as_long([a],[1,2]). Yes. ?- twice_as_long([a,b],X). X = [_G328, _G331, _G334, _G337] ; No ?- twice_as_long(X,[_,_]). X = [_G328] ; No ?- twice_as_long([_],X). X = [_G313, _G316] ; No ======================================================== 4. Write predicate fib(N,F) that is true if F is the Nth Fibonacci number. Compute fib(5,F), fib(10,F), fib(50,F). ======================================================== 5. Implement Extended Euclidean Algorithm to compute greatest common divisors in integers. ========================================================