subject

Write a function that receives an integer (n) argument and then computes the following based on the value of the integer: while the value of n is greater than 1, replace the integer with half of its value (n/2) if the integer is even. otherwise, replace the integer with three times its value, plus 1 (3*n + 1). make provision to count the number of values in (or the length of) the sequence that results. test your function: if n = 10, the sequence of integers is 5, 16, 8, 4, 2, 1 and so the length is 6. make a plot of the length of the sequence that occurs as a function of the integers from 2 to 30. for example, when n = 10, the length is 6 while for n = 15, the length is 17.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 19:30
Keep your choice of a major there is probably no single correct choice.
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
This chapter lists many ways in which becoming computer literate is beneficial. think about what your life will be like once you’re started in your career. what areas of computing will be most important for you to understand? how would an understanding of computer hardware and software you in working from home, working with groups in other countries and contributing your talents.
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Aconsumer would pay an extra they used the rent to own program to buy the computer, rather than using cash. for all of the items, is the cheapest option over the life of the contract. the most expensive overall option is to use purchase the item.
Answers: 2
question
Computers and Technology, 25.06.2019 01:00
Why was it important for the date format to be standardized by the international organization for standardization
Answers: 1
You know the right answer?
Write a function that receives an integer (n) argument and then computes the following based on the...
Questions
question
Mathematics, 12.12.2020 16:10
question
Mathematics, 12.12.2020 16:10
Questions on the website: 13722363