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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!