subject

Suppose that the first number of a sequence is x, where x is an integer. define: a0 = x; an+1 = an / 2 if an is even; an+1 = 3 x an + 1 if an is odd. then there exists an integer k such that ak = 1. instructions write a program that prompts the user to input the value of x. the program outputs: the numbers a0, a1, a2, . . , ak. the integer k such that ak = 1 (for example, if x = 75, then k = 14, and the numbers a0, a1, a2, a14, respectively, are 75, 226, 113, 340, 170, 85, 256, 128, 64, 32, 16, 8, 4, 2, 1.) test your program for the following values of x: 75, 111, 678, 732, 873, 2048, and 65535.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 00:00
How do we use the sumif formula (when dealing with different formats) ?
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
In deadlock avoidance using banker’s algorithm, what would be the consequence(s) of: (i) a process declaring its maximum need as maximum possible for each resource. in other words, if a resource a has 5 instances, then each process declares its maximum need as 5. (ii) a process declaring its minimum needs as maximum needs. for example, a process may need 2-5 instances of resource a. but it declares its maximum need as 2.
Answers: 3
question
Computers and Technology, 23.06.2019 02:30
Research data that is presented using descriptive language is said to be
Answers: 2
question
Computers and Technology, 23.06.2019 12:00
Using the list, you can select the number of photos that will appear on each slide. a. theme b. frame shape c. pictures in album d. picture layout
Answers: 1
You know the right answer?
Suppose that the first number of a sequence is x, where x is an integer. define: a0 = x; an+1 = an...
Questions
question
History, 02.02.2020 17:45
question
Mathematics, 02.02.2020 17:45
Questions on the website: 13722363