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, 22.06.2019 07:30
Jasper and samantha are in a robotics competition. the guidelines state that the robots should be able to move a 10-gram weight at least 2 meters and turn in a circle. jasper and samantha have already built the robot. which step of the design process should they follow next to decide whether their robot meets the minimum criteria for the competition?
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
All of the following are characteristics that must be contained in any knowledge representation scheme except
Answers: 3
question
Computers and Technology, 24.06.2019 11:00
Under the home tab, where can a user find options to change the bullet style of an outline? in the slides group in the font group in the paragraph group in the drawing group
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
These statements describe lists in presentation programs: a. bullets can be turned off and on. b. bullets cannot be turned off. c. bullet styles, colors, and sizes can be changed. d. lists don't have to use bullets or numbers. e. numbering styles, colors, and sizes can be changed. f. numbers can be turned off and on. g. numbers cannot be turned off. select all that apply
Answers: 2
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, 24.06.2019 00:30
question
Mathematics, 24.06.2019 00:30
Questions on the website: 13722360