Question: This is an R programming language The Collatz function C(x) takes any integer x as an input, and then follows these steps If x is


This is an R programming language
The Collatz function C(x) takes any integer x as an input, and then follows these steps If x is odd then C(x) = 3x If x is even then C(x)x/2 1 Task 1: Make a function which takes a number x as an argument and returns 3x +1 Task 2: Make a function which takes a number x as an argument and returns x/2. Task 3: Make a function that implements the Collatz function. Task 4: Make a function that iterates the Collatz function a user specified n of times, and returns the trajectory. Task 5: Make a function that iterates the Collatz function and stops when the trajectory reaches 1. It should then print out the trajectory. Task 6: Make a function which takes a number x as an argument and returns a function it takes to reach the number 1. list that contains the orbit of x and the number of iterations of the Collatz
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
