Question: i need help in these two please Write a recursive function rec a a(k) that generates a vector with the first k terms in the
Write a recursive function rec a a(k) that generates a vector with the first k terms in the sequence a(n+1)=pa(n)+(1+a(n)). where p=0.9,a(1)=0.5 As a test case: the call rec- (2) should generate the vector [0.5,1.95]. Implement the recursive function collatz (n), which generates an array with the Collotz sequence of a number n. It's defined as follows: Collatz (n)=1n,Collatz(n/2)]n,Collatz(3n+1)]ifn=1ifnisevenotherwise In addition to your function, submit the result of the function call
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
